Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3641)

Unified Diff: chrome/browser/resources/settings/people_page/sync_page.js

Issue 2104173002: Settings People Revamp: Cache the selected Sync individual data types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..73d073f4e0c8a70dfdad3587fe873f44a7c82e5a 100644
--- a/chrome/browser/resources/settings/people_page/sync_page.js
+++ b/chrome/browser/resources/settings/people_page/sync_page.js
@@ -67,6 +67,14 @@ Polymer({
},
/**
+ * Caches the individually selected synced data types. This is used to
+ * be able to restore the selections after checking and unchecking Sync All.
dpapad 2016/06/28 22:23:32 @private
tommycli 2016/06/29 00:04:07 Done.
+ */
+ 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.
@@ -188,18 +196,34 @@ Polymer({
* @private
*/
onSyncAllDataTypesChanged_: function(event) {
+ var SyncPrefsIndividualDataTypes = [
dpapad 2016/06/28 22:23:33 Can this array be moved outside this function as a
tommycli 2016/06/29 00:04:07 Done.
+ 'appsSynced',
+ 'extensionsSynced',
+ 'preferencesSynced',
+ 'autofillSynced',
+ 'typedUrlsSynced',
+ 'themesSynced',
+ 'bookmarksSynced',
+ 'passwordsSynced',
+ 'tabsSynced',
+ 'paymentsIntegrationEnabled',
+ ];
+
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 (dataType of SyncPrefsIndividualDataTypes) {
+ this.cachedSyncPrefs_[dataType] = this.syncPrefs[dataType];
dpapad 2016/06/28 22:23:33 What is the key/value pair of syncPrefs look like?
tommycli 2016/06/29 00:04:07 Done. I added a comment.
+
+ 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_();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698