| Index: chrome/browser/resources/settings/people_page/sync_page.js
|
| diff --git a/chrome/browser/resources/settings/people_page/sync_page.js b/chrome/browser/resources/settings/people_page/sync_page.js
|
| index c50b263903c447012519667dfd7d8f6da42fe7ef..f1d0daa814f63163f80f6f2c75795f365e11714c 100644
|
| --- a/chrome/browser/resources/settings/people_page/sync_page.js
|
| +++ b/chrome/browser/resources/settings/people_page/sync_page.js
|
| @@ -15,6 +15,24 @@ var RadioButtonNames = {
|
| };
|
|
|
| /**
|
| + * Names of the individual data type properties to be cached from
|
| + * settings.SyncPrefs when the user checks 'Sync All'.
|
| + * @type {!Array<string>}
|
| + */
|
| +var SyncPrefsIndividualDataTypes = [
|
| + 'appsSynced',
|
| + 'extensionsSynced',
|
| + 'preferencesSynced',
|
| + 'autofillSynced',
|
| + 'typedUrlsSynced',
|
| + 'themesSynced',
|
| + 'bookmarksSynced',
|
| + 'passwordsSynced',
|
| + 'tabsSynced',
|
| + 'paymentsIntegrationEnabled',
|
| +];
|
| +
|
| +/**
|
| * @fileoverview
|
| * 'settings-sync-page' is the settings page containing sync settings.
|
| *
|
| @@ -67,6 +85,15 @@ Polymer({
|
| },
|
|
|
| /**
|
| + * Caches the individually selected synced data types. This is used to
|
| + * be able to restore the selections after checking and unchecking Sync All.
|
| + * @private
|
| + */
|
| + cachedSyncPrefs_: {
|
| + type: Object,
|
| + },
|
| +
|
| + /**
|
| * Whether the "create passphrase" inputs should be shown. These inputs
|
| * give the user the opportunity to use a custom passphrase instead of
|
| * authenticating with his Google credentials.
|
| @@ -184,22 +211,26 @@ Polymer({
|
|
|
| /**
|
| * Handler for when the sync all data types checkbox is changed.
|
| - * @param {Event} event
|
| + * @param {!Event} event
|
| * @private
|
| */
|
| onSyncAllDataTypesChanged_: function(event) {
|
| if (event.target.checked) {
|
| this.set('syncPrefs.syncAllDataTypes', true);
|
| - this.set('syncPrefs.appsSynced', true);
|
| - this.set('syncPrefs.extensionsSynced', true);
|
| - this.set('syncPrefs.preferencesSynced', true);
|
| - this.set('syncPrefs.autofillSynced', true);
|
| - this.set('syncPrefs.typedUrlsSynced', true);
|
| - this.set('syncPrefs.themesSynced', true);
|
| - this.set('syncPrefs.bookmarksSynced', true);
|
| - this.set('syncPrefs.passwordsSynced', true);
|
| - this.set('syncPrefs.tabsSynced', true);
|
| - this.set('syncPrefs.paymentsIntegrationEnabled', true);
|
| +
|
| + // Cache the previously selected preference before checking every box.
|
| + this.cachedSyncPrefs_ = {};
|
| + for (var dataType of SyncPrefsIndividualDataTypes) {
|
| + // These are all booleans, so this shallow copy is sufficient.
|
| + this.cachedSyncPrefs_[dataType] = this.syncPrefs[dataType];
|
| +
|
| + this.set(['syncPrefs', dataType], true);
|
| + }
|
| + } else if (this.cachedSyncPrefs_) {
|
| + // Restore the previously selected preference.
|
| + for (dataType of SyncPrefsIndividualDataTypes) {
|
| + this.set(['syncPrefs', dataType], this.cachedSyncPrefs_[dataType]);
|
| + }
|
| }
|
|
|
| this.onSingleSyncDataTypeChanged_();
|
|
|