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

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

Issue 553573003: Compile chrome://settings, part 3: 167 proper errors left (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@G_options_errors_1
Patch Set: rebase Created 6 years, 3 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,
8 * appsRegistered: boolean,
9 * appsSynced: boolean,
10 * autofillEnforced: boolean,
11 * autofillRegistered: boolean,
12 * autofillSynced: boolean,
13 * bookmarksEnforced: boolean,
14 * bookmarksRegistered: boolean,
15 * bookmarksSynced: boolean,
16 * encryptAllData: boolean,
17 * enterGooglePassphraseBody: (string|undefined),
18 * enterPassphraseBody: (string|undefined),
19 * extensionsEnforced: boolean,
20 * extensionsRegistered: boolean,
21 * extensionsSynced: boolean,
22 * fullEncryptionBody: string,
23 * isSupervised: boolean,
24 * passphraseFailed: boolean,
25 * passwordsEnforced: boolean,
26 * passwordsRegistered: boolean,
27 * passwordsSynced: boolean,
28 * preferencesEnforced: boolean,
29 * preferencesRegistered: boolean,
30 * preferencesSynced: boolean,
31 * showPassphrase: boolean,
32 * showSyncEverythingPage: boolean,
33 * syncAllDataTypes: boolean,
34 * syncNothing: boolean,
35 * tabsEnforced: boolean,
36 * tabsRegistered: boolean,
37 * tabsSynced: boolean,
38 * themesEnforced: boolean,
39 * themesRegistered: boolean,
40 * themesSynced: boolean,
41 * typedUrlsEnforced: boolean,
42 * typedUrlsRegistered: boolean,
43 * typedUrlsSynced: boolean,
44 * usePassphrase: boolean}}
45 */
46 var SyncConfig;
47
7 /** 48 /**
8 * The user's selection in the synced data type drop-down menu, as an index. 49 * The user's selection in the synced data type drop-down menu, as an index.
9 * @enum {number} 50 * @enum {number}
10 * @const 51 * @const
11 */ 52 */
12 options.DataTypeSelection = { 53 options.DataTypeSelection = {
13 SYNC_EVERYTHING: 0, 54 SYNC_EVERYTHING: 0,
14 CHOOSE_WHAT_TO_SYNC: 1, 55 CHOOSE_WHAT_TO_SYNC: 1,
15 SYNC_NOTHING: 2 56 SYNC_NOTHING: 2
16 }; 57 };
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 210 }
170 }, 211 },
171 212
172 /** 213 /**
173 * Enables / grays out the sync data type checkboxes in the advanced 214 * Enables / grays out the sync data type checkboxes in the advanced
174 * settings dialog. 215 * settings dialog.
175 * @param {boolean} enabled True for enabled, false for grayed out. 216 * @param {boolean} enabled True for enabled, false for grayed out.
176 * @private 217 * @private
177 */ 218 */
178 setDataTypeCheckboxesEnabled_: function(enabled) { 219 setDataTypeCheckboxesEnabled_: function(enabled) {
179 for (dataType in dataTypeBoxesDisabled_) { 220 for (var dataType in dataTypeBoxesDisabled_) {
180 $(dataType).disabled = !enabled || dataTypeBoxesDisabled_[dataType]; 221 $(dataType).disabled = !enabled || dataTypeBoxesDisabled_[dataType];
181 } 222 }
182 }, 223 },
183 224
184 /** 225 /**
185 * Sets the state of the sync data type checkboxes based on whether "Sync 226 * Sets the state of the sync data type checkboxes based on whether "Sync
186 * everything", "Choose what to sync", or "Sync nothing" are selected in the 227 * everything", "Choose what to sync", or "Sync nothing" are selected in the
187 * drop-down menu of the advanced settings dialog. 228 * drop-down menu of the advanced settings dialog.
188 * @param {options.DataTypeSelection} selectedIndex Index of user's 229 * @param {options.DataTypeSelection} selectedIndex Index of user's
189 * selection. 230 * selection.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 options.DataTypeSelection.SYNC_EVERYTHING); 354 options.DataTypeSelection.SYNC_EVERYTHING);
314 return false; 355 return false;
315 }; 356 };
316 }, 357 },
317 358
318 /** 359 /**
319 * Shows or hides the sync data type checkboxes in the advanced sync 360 * Shows or hides the sync data type checkboxes in the advanced sync
320 * settings dialog. Also initializes |dataTypeBoxesChecked_| and 361 * settings dialog. Also initializes |dataTypeBoxesChecked_| and
321 * |dataTypeBoxedDisabled_| with their values, and makes their onclick 362 * |dataTypeBoxedDisabled_| with their values, and makes their onclick
322 * handlers update |dataTypeBoxesChecked_|. 363 * handlers update |dataTypeBoxesChecked_|.
323 * @param {Object} args The configuration data used to show/hide UI. 364 * @param {SyncConfig} args The configuration data used to show/hide UI.
324 * @private 365 * @private
325 */ 366 */
326 setChooseDataTypesCheckboxes_: function(args) { 367 setChooseDataTypesCheckboxes_: function(args) {
327 var datatypeSelect = $('sync-select-datatypes'); 368 var datatypeSelect = $('sync-select-datatypes');
328 datatypeSelect.selectedIndex = args.syncAllDataTypes ? 369 datatypeSelect.selectedIndex = args.syncAllDataTypes ?
329 options.DataTypeSelection.SYNC_EVERYTHING : 370 options.DataTypeSelection.SYNC_EVERYTHING :
330 options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC; 371 options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC;
331 372
332 $('bookmarks-checkbox').checked = args.bookmarksSynced; 373 $('bookmarks-checkbox').checked = args.bookmarksSynced;
333 dataTypeBoxesChecked_['bookmarks-checkbox'] = args.bookmarksSynced; 374 dataTypeBoxesChecked_['bookmarks-checkbox'] = args.bookmarksSynced;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 * |dataTypeBoxesChecked_|. Used as an onclick handler for each data type 448 * |dataTypeBoxesChecked_|. Used as an onclick handler for each data type
408 * checkbox. 449 * checkbox.
409 * @private 450 * @private
410 */ 451 */
411 handleDataTypeClick_: function() { 452 handleDataTypeClick_: function() {
412 dataTypeBoxesChecked_[this.id] = this.checked; 453 dataTypeBoxesChecked_[this.id] = this.checked;
413 chrome.send('coreOptionsUserMetricsAction', 454 chrome.send('coreOptionsUserMetricsAction',
414 ['Options_SyncToggleDataType']); 455 ['Options_SyncToggleDataType']);
415 }, 456 },
416 457
458 /**
459 * @param {SyncConfig} args
460 */
417 setEncryptionRadios_: function(args) { 461 setEncryptionRadios_: function(args) {
418 if (!args.encryptAllData && !args.usePassphrase) { 462 if (!args.encryptAllData && !args.usePassphrase) {
419 $('basic-encryption-option').checked = true; 463 $('basic-encryption-option').checked = true;
420 } else { 464 } else {
421 $('full-encryption-option').checked = true; 465 $('full-encryption-option').checked = true;
422 $('full-encryption-option').disabled = true; 466 $('full-encryption-option').disabled = true;
423 $('basic-encryption-option').disabled = true; 467 $('basic-encryption-option').disabled = true;
424 } 468 }
425 }, 469 },
426 470
471 /**
472 * @param {SyncConfig} args
473 */
427 setCheckboxesAndErrors_: function(args) { 474 setCheckboxesAndErrors_: function(args) {
428 this.setChooseDataTypesCheckboxes_(args); 475 this.setChooseDataTypesCheckboxes_(args);
429 this.setEncryptionRadios_(args); 476 this.setEncryptionRadios_(args);
430 }, 477 },
431 478
479 /**
480 * @param {SyncConfig} args
481 */
432 showConfigure_: function(args) { 482 showConfigure_: function(args) {
433 var datatypeSelect = $('sync-select-datatypes'); 483 var datatypeSelect = $('sync-select-datatypes');
434 var self = this; 484 var self = this;
435 485
436 // Cache the sync config args so they can be reused when we transition 486 // Cache the sync config args so they can be reused when we transition
437 // between the drop-down menu items in the advanced settings dialog. 487 // between the drop-down menu items in the advanced settings dialog.
438 if (args) 488 if (args)
439 this.syncConfigureArgs_ = args; 489 this.syncConfigureArgs_ = args;
440 490
441 // Required in order to determine whether to give focus to the OK button 491 // Required in order to determine whether to give focus to the OK button
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Hide the "use default settings" link. 607 // Hide the "use default settings" link.
558 $('use-default-link').hidden = true; 608 $('use-default-link').hidden = true;
559 $('use-default-link').disabled = true; 609 $('use-default-link').disabled = true;
560 $('use-default-link').onclick = null; 610 $('use-default-link').onclick = null;
561 }, 611 },
562 612
563 /** 613 /**
564 * Reveals the UI for entering a custom passphrase during initial setup. 614 * Reveals the UI for entering a custom passphrase during initial setup.
565 * This happens if the user has previously enabled a custom passphrase on a 615 * This happens if the user has previously enabled a custom passphrase on a
566 * different machine. 616 * different machine.
567 * @param {Array} args The args that contain the passphrase UI 617 * @param {SyncConfig} args The args that contain the passphrase UI
568 * configuration. 618 * configuration.
569 * @private 619 * @private
570 */ 620 */
571 showPassphraseContainer_: function(args) { 621 showPassphraseContainer_: function(args) {
572 // Once we require a passphrase, we prevent the user from returning to 622 // Once we require a passphrase, we prevent the user from returning to
573 // the Sync Everything pane. 623 // the Sync Everything pane.
574 $('use-default-link').hidden = true; 624 $('use-default-link').hidden = true;
575 $('use-default-link').disabled = true; 625 $('use-default-link').disabled = true;
576 $('use-default-link').onclick = null; 626 $('use-default-link').onclick = null;
577 $('sync-custom-passphrase-container').hidden = true; 627 $('sync-custom-passphrase-container').hidden = true;
(...skipping 18 matching lines...) Expand all
596 // previously but failed). 646 // previously but failed).
597 $('incorrect-passphrase').hidden = 647 $('incorrect-passphrase').hidden =
598 !(args.usePassphrase && args.passphraseFailed); 648 !(args.usePassphrase && args.passphraseFailed);
599 649
600 $('sync-passphrase-warning').hidden = false; 650 $('sync-passphrase-warning').hidden = false;
601 }, 651 },
602 652
603 /** 653 /**
604 * Displays the advanced sync setting dialog, and pre-selects either the 654 * Displays the advanced sync setting dialog, and pre-selects either the
605 * "Sync everything" or the "Choose what to sync" drop-down menu item. 655 * "Sync everything" or the "Choose what to sync" drop-down menu item.
656 * @param {SyncConfig} args
606 * @param {options.DataTypeSelection} index Index of item to pre-select. 657 * @param {options.DataTypeSelection} index Index of item to pre-select.
607 * @private 658 * @private
608 */ 659 */
609 showCustomizePage_: function(args, index) { 660 showCustomizePage_: function(args, index) {
610 // Determine whether to bring the OK button field into focus. 661 // Determine whether to bring the OK button field into focus.
611 var wasCustomizePageHidden = !this.customizePageVisible_; 662 var wasCustomizePageHidden = !this.customizePageVisible_;
612 this.customizePageVisible_ = true; 663 this.customizePageVisible_ = true;
613 this.confirmPageVisible_ = false; 664 this.confirmPageVisible_ = false;
614 665
615 $('confirm-sync-preferences').hidden = true; 666 $('confirm-sync-preferences').hidden = true;
(...skipping 27 matching lines...) Expand all
643 $('use-default-link').onclick = function() { 694 $('use-default-link').onclick = function() {
644 SyncSetupOverlay.showSyncEverythingPage(); 695 SyncSetupOverlay.showSyncEverythingPage();
645 return false; 696 return false;
646 }; 697 };
647 } 698 }
648 }, 699 },
649 700
650 /** 701 /**
651 * Shows the appropriate sync setup page. 702 * Shows the appropriate sync setup page.
652 * @param {string} page A page of the sync setup to show. 703 * @param {string} page A page of the sync setup to show.
653 * @param {Object} args Data from the C++ to forward on to the right 704 * @param {SyncConfig} args Data from the C++ to forward on to the right
654 * section. 705 * section.
655 */ 706 */
656 showSyncSetupPage_: function(page, args) { 707 showSyncSetupPage_: function(page, args) {
657 // If the user clicks the OK button, dismiss the dialog immediately, and 708 // If the user clicks the OK button, dismiss the dialog immediately, and
658 // do not go through the process of hiding elements of the overlay. 709 // do not go through the process of hiding elements of the overlay.
659 // See crbug.com/308873. 710 // See crbug.com/308873.
660 if (page == 'done') { 711 if (page == 'done') {
661 this.closeOverlay_(); 712 this.closeOverlay_();
662 return; 713 return;
663 } 714 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 867
817 SyncSetupOverlay.showStopSyncingUI = function() { 868 SyncSetupOverlay.showStopSyncingUI = function() {
818 SyncSetupOverlay.getInstance().showStopSyncingUI_(); 869 SyncSetupOverlay.getInstance().showStopSyncingUI_();
819 }; 870 };
820 871
821 // Export 872 // Export
822 return { 873 return {
823 SyncSetupOverlay: SyncSetupOverlay 874 SyncSetupOverlay: SyncSetupOverlay
824 }; 875 };
825 }); 876 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/website_settings.js ('k') | ui/webui/resources/js/cr/ui/list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698