Commit 12e8b4f9 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[unified-consent] Remove USER_EVENTS from settings

The toggle for the sync data type USER_EVENTS, aka
"Activity and Interactions", is removed from the
settings page.

Bug: 905342
Change-Id: Ib1fb2b5e66658628bd12b7de2e2bd7db6c398b8c
Reviewed-on: https://chromium-review.googlesource.com/c/1336148Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608315}
parent 1f1d363c
...@@ -97,9 +97,6 @@ settings.StatusAction = { ...@@ -97,9 +97,6 @@ settings.StatusAction = {
* typedUrlsEnforced: boolean, * typedUrlsEnforced: boolean,
* typedUrlsRegistered: boolean, * typedUrlsRegistered: boolean,
* typedUrlsSynced: boolean, * typedUrlsSynced: boolean,
* userEventsEnforced: boolean,
* userEventsRegistered: boolean,
* userEventsSynced: boolean,
* }} * }}
*/ */
settings.SyncPrefs; settings.SyncPrefs;
......
...@@ -373,36 +373,6 @@ ...@@ -373,36 +373,6 @@
aria-label="$i18n{enablePaymentsIntegrationCheckboxLabel}"> aria-label="$i18n{enablePaymentsIntegrationCheckboxLabel}">
</cr-toggle> </cr-toggle>
</div> </div>
<!-- User events is disabled and unchecked if data is encrypted or
typed urls are disabled. -->
<template is="dom-if" if="[[unifiedConsentEnabled]]">
<div hidden="[[!syncPrefs.userEventsRegistered]]"
class$="[[getPassphraseHintLines_(syncPrefs.encryptAllData)]]
layout horizontal list-item">
<div class="start" id="userEventsCheckboxLabel">
$i18n{userEventsCheckboxLabel}
<div class="secondary">
$i18n{userEventsCheckboxText}
<div id="reset-sync-message-box-user-events"
hidden="[[!syncPrefs.encryptAllData]]">
<iron-icon icon="settings:info-outline"
class="passphrase-reset-icon">
</iron-icon>
$i18nRaw{passphraseResetHintToggle}
</div>
</div>
</div>
<cr-toggle id="userEventsToggle"
checked="{{userEventsToggleValue}}"
on-change="onUserEventsSyncDataTypeChanged_"
disabled="[[shouldUserEventsCheckboxBeDisabled_(
syncPrefs.syncAllDataTypes, syncPrefs.typedUrlsSynced,
syncPrefs.userEventsEnforced, syncPrefs.encryptAllData)]]"
aria-labelledby="userEventsCheckboxLabel">
</cr-toggle>
</div>
</template>
</div> </div>
<div id="other-sync-items" <div id="other-sync-items"
......
...@@ -165,11 +165,6 @@ Polymer({ ...@@ -165,11 +165,6 @@ Polymer({
} }
}, },
// The toggle for user events is not reflected directly on
// syncPrefs.userEventsSynced, because this sync preference must only be
// updated if there is no passphrase and typedUrls are synced as well.
userEventsToggleValue: Boolean,
// <if expr="not chromeos"> // <if expr="not chromeos">
diceEnabled: Boolean, diceEnabled: Boolean,
// </if> // </if>
...@@ -342,11 +337,6 @@ Polymer({ ...@@ -342,11 +337,6 @@ Polymer({
if (!this.syncPrefs.autofillRegistered || !this.syncPrefs.autofillSynced) if (!this.syncPrefs.autofillRegistered || !this.syncPrefs.autofillSynced)
this.set('syncPrefs.paymentsIntegrationEnabled', false); this.set('syncPrefs.paymentsIntegrationEnabled', false);
this.set(
'userEventsToggleValue',
this.syncPrefs.userEventsSynced && this.syncPrefs.typedUrlsSynced &&
!this.syncPrefs.encryptAllData);
// Hide the new passphrase box if the sync data has been encrypted. // Hide the new passphrase box if the sync data has been encrypted.
if (this.syncPrefs.encryptAllData) if (this.syncPrefs.encryptAllData)
this.creatingNewPassphrase_ = false; this.creatingNewPassphrase_ = false;
...@@ -421,25 +411,6 @@ Polymer({ ...@@ -421,25 +411,6 @@ Polymer({
* @private * @private
*/ */
onTypedUrlsDataTypeChanged_: function() { onTypedUrlsDataTypeChanged_: function() {
// Enabling typed URLs also resets the user events to ON. |encryptAllData|
// is not expected to change on the fly, and if it changed the user sync
// settings would be reset anyway.
if (!this.syncPrefs.encryptAllData && this.syncPrefs.typedUrlsSynced)
this.set('syncPrefs.userEventsSynced', true);
this.onSingleSyncDataTypeChanged_();
},
/**
* Handler for when the user events data type checkbox is changed.
* @private
*/
onUserEventsSyncDataTypeChanged_: function() {
// Only update the sync preference when there is no passphrase and typed
// URLs are synced.
assert(!this.syncPrefs.encryptAllData && this.syncPrefs.typedUrlsSynced);
this.set('syncPrefs.userEventsSynced', this.userEventsToggleValue);
this.onSingleSyncDataTypeChanged_(); this.onSingleSyncDataTypeChanged_();
}, },
...@@ -577,19 +548,6 @@ Polymer({ ...@@ -577,19 +548,6 @@ Polymer({
return syncAllDataTypes || !autofillSynced; return syncAllDataTypes || !autofillSynced;
}, },
/**
* @param {boolean} syncAllDataTypes
* @param {boolean} typedUrlsSynced
* @param {boolean} userEventsEnforced
* @param {boolean} encryptAllData
* @return {boolean} Whether the sync checkbox should be disabled.
*/
shouldUserEventsCheckboxBeDisabled_: function(
syncAllDataTypes, typedUrlsSynced, userEventsEnforced, encryptAllData) {
return syncAllDataTypes || !typedUrlsSynced || userEventsEnforced ||
encryptAllData;
},
/** /**
* Checks the supplied passphrases to ensure that they are not empty and that * Checks the supplied passphrases to ensure that they are not empty and that
* they match each other. Additionally, displays error UI if they are invalid. * they match each other. Additionally, displays error UI if they are invalid.
......
...@@ -54,9 +54,6 @@ cr.define('settings_people_page_sync_page', function() { ...@@ -54,9 +54,6 @@ cr.define('settings_people_page_sync_page', function() {
typedUrlsEnforced: false, typedUrlsEnforced: false,
typedUrlsRegistered: true, typedUrlsRegistered: true,
typedUrlsSynced: true, typedUrlsSynced: true,
userEventsEnforced: false,
userEventsRegistered: true,
userEventsSynced: true,
}; };
} }
...@@ -679,76 +676,6 @@ cr.define('settings_people_page_sync_page', function() { ...@@ -679,76 +676,6 @@ cr.define('settings_people_page_sync_page', function() {
assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden); assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden);
}); });
test('UserEvents_UnifiedConsent_Encrypted', function() {
const prefs = getSyncAllPrefs();
prefs.encryptAllData = true;
openDatatypeConfigurationWithUnifiedConsent(prefs);
const unifiedConsentToggle = syncPage.$$('#unifiedConsentToggle');
// The unified consent toggle is disabled when the data types are
// encrypted.
assertTrue(unifiedConsentToggle.disabled);
assertTrue(prefs.userEventsSynced);
// History.
historyToggle = syncPage.$$('#historyToggle');
assertFalse(historyToggle.disabled);
assertTrue(historyToggle.checked);
// User events.
userEventsToggle = syncPage.$$('#userEventsToggle');
assertTrue(userEventsToggle.disabled);
assertFalse(userEventsToggle.checked);
resetSyncMessageBox = syncPage.$$('#reset-sync-message-box-user-events');
assertFalse(resetSyncMessageBox.hidden);
});
test('UserEvents_UnifiedConsent_NotEncrypted', function() {
const prefs = getSyncAllPrefs();
openDatatypeConfigurationWithUnifiedConsent(prefs);
const unifiedConsentToggle = syncPage.$$('#unifiedConsentToggle');
// The unified consent toggle is enabled when the data types are not
// encrypted.
assertFalse(unifiedConsentToggle.disabled);
assertTrue(prefs.userEventsSynced);
// Check history toggle.
historyToggle = syncPage.$$('#historyToggle');
assertFalse(historyToggle.disabled);
assertTrue(historyToggle.checked);
// Check user events toggle.
userEventsToggle = syncPage.$$('#userEventsToggle');
assertFalse(userEventsToggle.disabled);
assertTrue(userEventsToggle.checked);
resetSyncMessageBox = syncPage.$$('#reset-sync-message-box-user-events');
assertTrue(resetSyncMessageBox.hidden);
// Toggling history also toggles user events.
// Turn history off.
historyToggle.click();
cr.webUIListenerCallback('sync-prefs-changed', prefs);
assertFalse(historyToggle.checked);
assertTrue(userEventsToggle.disabled);
assertFalse(userEventsToggle.checked);
assertTrue(resetSyncMessageBox.hidden);
assertTrue(prefs.userEventsSynced);
// Turn history on.
historyToggle.click();
cr.webUIListenerCallback('sync-prefs-changed', prefs);
assertTrue(historyToggle.checked);
assertFalse(userEventsToggle.disabled);
assertTrue(userEventsToggle.checked);
assertTrue(prefs.userEventsSynced);
// Toggling user events also toggles the sync preference.
userEventsToggle.click();
cr.webUIListenerCallback('sync-prefs-changed', prefs);
assertFalse(userEventsToggle.disabled);
assertFalse(userEventsToggle.checked);
assertFalse(prefs.userEventsSynced);
assertTrue(resetSyncMessageBox.hidden);
});
test( test(
'ExistingPassphraseSubmitButtonDisabledWhenExistingPassphraseEmpty', 'ExistingPassphraseSubmitButtonDisabledWhenExistingPassphraseEmpty',
function() { function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment