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

Side by Side Diff: chrome/browser/resources/options/sync_setup_overlay.js

Issue 1578173005: Move Autofill Payments integration checkbox to the sync settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.exportPath('options'); 5 cr.exportPath('options');
6 6
7 /** @typedef {{appsEnforced: boolean, 7 /** @typedef {{appsEnforced: boolean,
8 * appsRegistered: boolean, 8 * appsRegistered: boolean,
9 * appsSynced: boolean, 9 * appsSynced: boolean,
10 * autofillEnforced: boolean, 10 * autofillEnforced: boolean,
11 * autofillRegistered: boolean, 11 * autofillRegistered: boolean,
12 * autofillSynced: boolean, 12 * autofillSynced: boolean,
13 * bookmarksEnforced: boolean, 13 * bookmarksEnforced: boolean,
14 * bookmarksRegistered: boolean, 14 * bookmarksRegistered: boolean,
15 * bookmarksSynced: boolean, 15 * bookmarksSynced: boolean,
16 * encryptAllData: boolean, 16 * encryptAllData: boolean,
17 * encryptAllDataAllowed: boolean, 17 * encryptAllDataAllowed: boolean,
18 * enterGooglePassphraseBody: (string|undefined), 18 * enterGooglePassphraseBody: (string|undefined),
19 * enterPassphraseBody: (string|undefined), 19 * enterPassphraseBody: (string|undefined),
20 * extensionsEnforced: boolean, 20 * extensionsEnforced: boolean,
21 * extensionsRegistered: boolean, 21 * extensionsRegistered: boolean,
22 * extensionsSynced: boolean, 22 * extensionsSynced: boolean,
23 * fullEncryptionBody: string, 23 * fullEncryptionBody: string,
24 * passphraseFailed: boolean, 24 * passphraseFailed: boolean,
25 * passwordsEnforced: boolean, 25 * passwordsEnforced: boolean,
26 * passwordsRegistered: boolean, 26 * passwordsRegistered: boolean,
27 * passwordsSynced: boolean, 27 * passwordsSynced: boolean,
28 * paymentsIntegrationEnabled: boolean,
28 * preferencesEnforced: boolean, 29 * preferencesEnforced: boolean,
29 * preferencesRegistered: boolean, 30 * preferencesRegistered: boolean,
30 * preferencesSynced: boolean, 31 * preferencesSynced: boolean,
31 * showPassphrase: boolean, 32 * showPassphrase: boolean,
32 * syncAllDataTypes: boolean, 33 * syncAllDataTypes: boolean,
33 * syncNothing: boolean, 34 * syncNothing: boolean,
34 * tabsEnforced: boolean, 35 * tabsEnforced: boolean,
35 * tabsRegistered: boolean, 36 * tabsRegistered: boolean,
36 * tabsSynced: boolean, 37 * tabsSynced: boolean,
37 * themesEnforced: boolean, 38 * themesEnforced: boolean,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 }; 153 };
153 $('stop-syncing-ok').onclick = function() { 154 $('stop-syncing-ok').onclick = function() {
154 var deleteProfile = $('delete-profile') != undefined && 155 var deleteProfile = $('delete-profile') != undefined &&
155 $('delete-profile').checked; 156 $('delete-profile').checked;
156 chrome.send('SyncSetupStopSyncing', [deleteProfile]); 157 chrome.send('SyncSetupStopSyncing', [deleteProfile]);
157 self.closeOverlay_(); 158 self.closeOverlay_();
158 }; 159 };
159 $('use-default-link').onclick = function() { 160 $('use-default-link').onclick = function() {
160 self.showSyncEverythingPage_(); 161 self.showSyncEverythingPage_();
161 }; 162 };
163 $('autofill-checkbox').onclick = function() {
164 self.paymentsIntegrationAvailableStateChanged_(
165 $('autofill-checkbox').checked);
166 };
162 }, 167 },
163 168
164 /** @private */ 169 /** @private */
165 showOverlay_: function() { 170 showOverlay_: function() {
166 PageManager.showPageByName('syncSetup'); 171 PageManager.showPageByName('syncSetup');
167 }, 172 },
168 173
169 /** @private */ 174 /** @private */
170 closeOverlay_: function() { 175 closeOverlay_: function() {
171 this.syncConfigureArgs_ = null; 176 this.syncConfigureArgs_ = null;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // configuration to the backend. 328 // configuration to the backend.
324 this.setInputElementsDisabledState_(true); 329 this.setInputElementsDisabledState_(true);
325 $('use-default-link').hidden = true; 330 $('use-default-link').hidden = true;
326 331
327 // These values need to be kept in sync with where they are read in 332 // These values need to be kept in sync with where they are read in
328 // sync_setup_handler.cc:GetConfiguration(). 333 // sync_setup_handler.cc:GetConfiguration().
329 var syncAll = $('sync-select-datatypes').selectedIndex == 334 var syncAll = $('sync-select-datatypes').selectedIndex ==
330 options.DataTypeSelection.SYNC_EVERYTHING; 335 options.DataTypeSelection.SYNC_EVERYTHING;
331 var syncNothing = $('sync-select-datatypes').selectedIndex == 336 var syncNothing = $('sync-select-datatypes').selectedIndex ==
332 options.DataTypeSelection.SYNC_NOTHING; 337 options.DataTypeSelection.SYNC_NOTHING;
338 var autofillSynced = syncAll || $('autofill-checkbox').checked;
333 var result = JSON.stringify({ 339 var result = JSON.stringify({
334 'syncAllDataTypes': syncAll, 340 'syncAllDataTypes': syncAll,
335 'syncNothing': syncNothing, 341 'syncNothing': syncNothing,
336 'bookmarksSynced': syncAll || $('bookmarks-checkbox').checked, 342 'bookmarksSynced': syncAll || $('bookmarks-checkbox').checked,
337 'preferencesSynced': syncAll || $('preferences-checkbox').checked, 343 'preferencesSynced': syncAll || $('preferences-checkbox').checked,
338 'themesSynced': syncAll || $('themes-checkbox').checked, 344 'themesSynced': syncAll || $('themes-checkbox').checked,
339 'passwordsSynced': syncAll || $('passwords-checkbox').checked, 345 'passwordsSynced': syncAll || $('passwords-checkbox').checked,
340 'autofillSynced': syncAll || $('autofill-checkbox').checked, 346 'autofillSynced': autofillSynced,
341 'extensionsSynced': syncAll || $('extensions-checkbox').checked, 347 'extensionsSynced': syncAll || $('extensions-checkbox').checked,
342 'typedUrlsSynced': syncAll || $('typed-urls-checkbox').checked, 348 'typedUrlsSynced': syncAll || $('typed-urls-checkbox').checked,
343 'appsSynced': syncAll || $('apps-checkbox').checked, 349 'appsSynced': syncAll || $('apps-checkbox').checked,
344 'tabsSynced': syncAll || $('tabs-checkbox').checked, 350 'tabsSynced': syncAll || $('tabs-checkbox').checked,
345 'wifiCredentialsSynced': syncAll || 351 'wifiCredentialsSynced':
346 $('wifi-credentials-checkbox').checked, 352 syncAll || $('wifi-credentials-checkbox').checked,
353 'paymentsIntegrationEnabled':
354 autofillSynced && $('payments-integration-checkbox').checked,
347 'encryptAllData': encryptAllData, 355 'encryptAllData': encryptAllData,
348 'usePassphrase': usePassphrase, 356 'usePassphrase': usePassphrase,
349 'isGooglePassphrase': googlePassphrase, 357 'isGooglePassphrase': googlePassphrase,
350 'passphrase': customPassphrase 358 'passphrase': customPassphrase
351 }); 359 });
352 chrome.send('SyncSetupConfigure', [result]); 360 chrome.send('SyncSetupConfigure', [result]);
353 }, 361 },
354 362
355 /** 363 /**
356 * Sets the disabled property of all input elements within the 'Customize 364 * Sets the disabled property of all input elements within the 'Customize
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 $('passwords-item').hidden = false; 422 $('passwords-item').hidden = false;
415 } else { 423 } else {
416 $('passwords-item').hidden = true; 424 $('passwords-item').hidden = true;
417 } 425 }
418 if (args.autofillRegistered) { 426 if (args.autofillRegistered) {
419 $('autofill-checkbox').checked = args.autofillSynced; 427 $('autofill-checkbox').checked = args.autofillSynced;
420 this.dataTypeBoxesChecked_['autofill-checkbox'] = args.autofillSynced; 428 this.dataTypeBoxesChecked_['autofill-checkbox'] = args.autofillSynced;
421 this.dataTypeBoxesDisabled_['autofill-checkbox'] = 429 this.dataTypeBoxesDisabled_['autofill-checkbox'] =
422 args.autofillEnforced; 430 args.autofillEnforced;
423 $('autofill-item').hidden = false; 431 $('autofill-item').hidden = false;
432 $('payments-integration-setting-area').hidden = false;
433 $('payments-integration-checkbox').checked =
434 args.autofillSynced && args.paymentsIntegrationEnabled;
435 $('payments-integration-checkbox').disabled = !args.autofillSynced;
424 } else { 436 } else {
425 $('autofill-item').hidden = true; 437 $('autofill-item').hidden = true;
438 $('payments-integration-setting-area').hidden = true;
426 } 439 }
427 if (args.extensionsRegistered) { 440 if (args.extensionsRegistered) {
428 $('extensions-checkbox').checked = args.extensionsSynced; 441 $('extensions-checkbox').checked = args.extensionsSynced;
429 this.dataTypeBoxesChecked_['extensions-checkbox'] = 442 this.dataTypeBoxesChecked_['extensions-checkbox'] =
430 args.extensionsSynced; 443 args.extensionsSynced;
431 this.dataTypeBoxesDisabled_['extensions-checkbox'] = 444 this.dataTypeBoxesDisabled_['extensions-checkbox'] =
432 args.extensionsEnforced; 445 args.extensionsEnforced;
433 $('extensions-item').hidden = false; 446 $('extensions-item').hidden = false;
434 } else { 447 } else {
435 $('extensions-item').hidden = true; 448 $('extensions-item').hidden = true;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 chrome.send('SyncSetupStartSignIn', [accessPoint]); 844 chrome.send('SyncSetupStartSignIn', [accessPoint]);
832 }, 845 },
833 846
834 /** 847 /**
835 * Forces user to sign out of Chrome for Chrome OS. 848 * Forces user to sign out of Chrome for Chrome OS.
836 * @private 849 * @private
837 */ 850 */
838 doSignOutOnAuthError_: function() { 851 doSignOutOnAuthError_: function() {
839 chrome.send('SyncSetupDoSignOutOnAuthError'); 852 chrome.send('SyncSetupDoSignOutOnAuthError');
840 }, 853 },
854
855 /**
856 * Toggles the visibility of the Payments integration checkbox.
please use gerrit instead 2016/01/15 17:05:32 Would this wording be better? s/visibility/enable
Justin Donnelly 2016/01/15 17:15:35 Oops, yeah, I copied this from the autofill settin
857 * @param {boolean} available Whether the user has the option of using
858 * Payments data.
859 * @private
860 */
861 paymentsIntegrationAvailableStateChanged_: function(available) {
862 $('payments-integration-checkbox').checked = available;
863 $('payments-integration-checkbox').disabled = !available;
864 },
841 }; 865 };
842 866
843 // Forward public APIs to private implementations. 867 // Forward public APIs to private implementations.
844 cr.makePublic(SyncSetupOverlay, [ 868 cr.makePublic(SyncSetupOverlay, [
845 'closeOverlay', 869 'closeOverlay',
846 'showSetupUI', 870 'showSetupUI',
847 'startSignIn', 871 'startSignIn',
848 'doSignOutOnAuthError', 872 'doSignOutOnAuthError',
849 'showSyncSetupPage', 873 'showSyncSetupPage',
850 'showCustomizePage', 874 'showCustomizePage',
851 'showStopSyncingUI', 875 'showStopSyncingUI',
852 ]); 876 ]);
853 877
854 // Export 878 // Export
855 return { 879 return {
856 SyncSetupOverlay: SyncSetupOverlay 880 SyncSetupOverlay: SyncSetupOverlay
857 }; 881 };
858 }); 882 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/sync_setup_overlay.html ('k') | chrome/browser/ui/webui/options/autofill_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698