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

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

Issue 543493002: Compile chrome://settings, part 2: reduce from 950 to 400 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@F_settings
Patch Set: fixed all but one comment (website_settings.js:42 left) 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');
6
7 /**
8 * The user's selection in the synced data type drop-down menu, as an index.
9 * @enum {number}
10 * @const
11 */
12 options.DataTypeSelection = {
13 SYNC_EVERYTHING: 0,
14 CHOOSE_WHAT_TO_SYNC: 1,
15 SYNC_NOTHING: 2
16 };
17
5 cr.define('options', function() { 18 cr.define('options', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 19 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; 20 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
8 21
9 // True if the synced account uses a custom passphrase. 22 // True if the synced account uses a custom passphrase.
10 var usePassphrase_ = false; 23 var usePassphrase_ = false;
11 24
12 // True if the synced account uses 'encrypt everything'. 25 // True if the synced account uses 'encrypt everything'.
13 var useEncryptEverything_ = false; 26 var useEncryptEverything_ = false;
14 27
(...skipping 17 matching lines...) Expand all
32 // Initialized when the advanced settings dialog is first brought up, and 45 // Initialized when the advanced settings dialog is first brought up, and
33 // reset when the dialog is closed. 46 // reset when the dialog is closed.
34 var dataTypeBoxesDisabled_ = {}; 47 var dataTypeBoxesDisabled_ = {};
35 48
36 // Used to determine whether to bring the OK button / passphrase field into 49 // Used to determine whether to bring the OK button / passphrase field into
37 // focus. 50 // focus.
38 var confirmPageVisible_ = false; 51 var confirmPageVisible_ = false;
39 var customizePageVisible_ = false; 52 var customizePageVisible_ = false;
40 53
41 /** 54 /**
42 * The user's selection in the synced data type drop-down menu, as an index.
43 * @enum {number}
44 * @const
45 */
46 var DataTypeSelection = {
47 SYNC_EVERYTHING: 0,
48 CHOOSE_WHAT_TO_SYNC: 1,
49 SYNC_NOTHING: 2
50 };
51
52 /**
53 * SyncSetupOverlay class 55 * SyncSetupOverlay class
54 * Encapsulated handling of the 'Sync Setup' overlay page. 56 * Encapsulated handling of the 'Sync Setup' overlay page.
55 * @class 57 * @class
56 */ 58 */
57 function SyncSetupOverlay() { 59 function SyncSetupOverlay() {
58 Page.call(this, 'syncSetup', 60 Page.call(this, 'syncSetup',
59 loadTimeData.getString('syncSetupOverlayTabTitle'), 61 loadTimeData.getString('syncSetupOverlayTabTitle'),
60 'sync-setup-overlay'); 62 'sync-setup-overlay');
61 } 63 }
62 64
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 * advanced sync settings dialog. Called when "Choose what to sync" is 149 * advanced sync settings dialog. Called when "Choose what to sync" is
148 * selected. Required because all the checkboxes are checked when 150 * selected. Required because all the checkboxes are checked when
149 * "Sync everything" is selected, and unchecked when "Sync nothing" is 151 * "Sync everything" is selected, and unchecked when "Sync nothing" is
150 * selected. Note: We only restore checkboxes for data types that are 152 * selected. Note: We only restore checkboxes for data types that are
151 * actually visible and whose old values are found in the cache, since it's 153 * actually visible and whose old values are found in the cache, since it's
152 * possible for some data types to not be registered, and therefore, their 154 * possible for some data types to not be registered, and therefore, their
153 * checkboxes remain hidden, and never get cached. 155 * checkboxes remain hidden, and never get cached.
154 * @private 156 * @private
155 */ 157 */
156 restoreDataTypeCheckboxes_: function() { 158 restoreDataTypeCheckboxes_: function() {
157 for (dataType in dataTypeBoxesChecked_) { 159 for (var dataType in dataTypeBoxesChecked_) {
158 $(dataType).checked = dataTypeBoxesChecked_[dataType]; 160 $(dataType).checked = dataTypeBoxesChecked_[dataType];
159 } 161 }
160 }, 162 },
161 163
162 /** 164 /**
163 * Enables / grays out the sync data type checkboxes in the advanced 165 * Enables / grays out the sync data type checkboxes in the advanced
164 * settings dialog. 166 * settings dialog.
165 * @param {boolean} enabled True for enabled, false for grayed out. 167 * @param {boolean} enabled True for enabled, false for grayed out.
166 * @private 168 * @private
167 */ 169 */
168 setDataTypeCheckboxesEnabled_: function(enabled) { 170 setDataTypeCheckboxesEnabled_: function(enabled) {
169 for (dataType in dataTypeBoxesDisabled_) { 171 for (dataType in dataTypeBoxesDisabled_) {
170 $(dataType).disabled = !enabled || dataTypeBoxesDisabled_[dataType]; 172 $(dataType).disabled = !enabled || dataTypeBoxesDisabled_[dataType];
171 } 173 }
172 }, 174 },
173 175
174 /** 176 /**
175 * Sets the state of the sync data type checkboxes based on whether "Sync 177 * Sets the state of the sync data type checkboxes based on whether "Sync
176 * everything", "Choose what to sync", or "Sync nothing" are selected in the 178 * everything", "Choose what to sync", or "Sync nothing" are selected in the
177 * drop-down menu of the advanced settings dialog. 179 * drop-down menu of the advanced settings dialog.
178 * @param {cr.DataTypeSelection} selectedIndex Index of user's selection. 180 * @param {options.DataTypeSelection} selectedIndex Index of user's
181 * selection.
179 * @private 182 * @private
180 */ 183 */
181 setDataTypeCheckboxes_: function(selectedIndex) { 184 setDataTypeCheckboxes_: function(selectedIndex) {
182 if (selectedIndex == DataTypeSelection.CHOOSE_WHAT_TO_SYNC) { 185 if (selectedIndex == options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC) {
183 this.setDataTypeCheckboxesEnabled_(true); 186 this.setDataTypeCheckboxesEnabled_(true);
184 this.restoreDataTypeCheckboxes_(); 187 this.restoreDataTypeCheckboxes_();
185 } else { 188 } else {
186 this.setDataTypeCheckboxesEnabled_(false); 189 this.setDataTypeCheckboxesEnabled_(false);
187 this.checkAllDataTypeCheckboxes_(selectedIndex == 190 this.checkAllDataTypeCheckboxes_(
188 DataTypeSelection.SYNC_EVERYTHING); 191 selectedIndex == options.DataTypeSelection.SYNC_EVERYTHING);
189 } 192 }
190 }, 193 },
191 194
192 checkPassphraseMatch_: function() { 195 checkPassphraseMatch_: function() {
193 var emptyError = $('empty-error'); 196 var emptyError = $('empty-error');
194 var mismatchError = $('mismatch-error'); 197 var mismatchError = $('mismatch-error');
195 emptyError.hidden = true; 198 emptyError.hidden = true;
196 mismatchError.hidden = true; 199 mismatchError.hidden = true;
197 200
198 var f = $('choose-data-types-form'); 201 var f = $('choose-data-types-form');
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Don't allow the user to tweak the settings once we send the 252 // Don't allow the user to tweak the settings once we send the
250 // configuration to the backend. 253 // configuration to the backend.
251 this.setInputElementsDisabledState_(true); 254 this.setInputElementsDisabledState_(true);
252 $('use-default-link').hidden = true; 255 $('use-default-link').hidden = true;
253 $('use-default-link').disabled = true; 256 $('use-default-link').disabled = true;
254 $('use-default-link').onclick = null; 257 $('use-default-link').onclick = null;
255 258
256 // These values need to be kept in sync with where they are read in 259 // These values need to be kept in sync with where they are read in
257 // SyncSetupFlow::GetDataTypeChoiceData(). 260 // SyncSetupFlow::GetDataTypeChoiceData().
258 var syncAll = $('sync-select-datatypes').selectedIndex == 261 var syncAll = $('sync-select-datatypes').selectedIndex ==
259 DataTypeSelection.SYNC_EVERYTHING; 262 options.DataTypeSelection.SYNC_EVERYTHING;
260 var syncNothing = $('sync-select-datatypes').selectedIndex == 263 var syncNothing = $('sync-select-datatypes').selectedIndex ==
261 DataTypeSelection.SYNC_NOTHING; 264 options.DataTypeSelection.SYNC_NOTHING;
262 var result = JSON.stringify({ 265 var result = JSON.stringify({
263 'syncAllDataTypes': syncAll, 266 'syncAllDataTypes': syncAll,
264 'syncNothing': syncNothing, 267 'syncNothing': syncNothing,
265 'bookmarksSynced': syncAll || $('bookmarks-checkbox').checked, 268 'bookmarksSynced': syncAll || $('bookmarks-checkbox').checked,
266 'preferencesSynced': syncAll || $('preferences-checkbox').checked, 269 'preferencesSynced': syncAll || $('preferences-checkbox').checked,
267 'themesSynced': syncAll || $('themes-checkbox').checked, 270 'themesSynced': syncAll || $('themes-checkbox').checked,
268 'passwordsSynced': syncAll || $('passwords-checkbox').checked, 271 'passwordsSynced': syncAll || $('passwords-checkbox').checked,
269 'autofillSynced': syncAll || $('autofill-checkbox').checked, 272 'autofillSynced': syncAll || $('autofill-checkbox').checked,
270 'extensionsSynced': syncAll || $('extensions-checkbox').checked, 273 'extensionsSynced': syncAll || $('extensions-checkbox').checked,
271 'typedUrlsSynced': syncAll || $('typed-urls-checkbox').checked, 274 'typedUrlsSynced': syncAll || $('typed-urls-checkbox').checked,
(...skipping 20 matching lines...) Expand all
292 var configureElements = 295 var configureElements =
293 $('customize-sync-preferences').querySelectorAll('input'); 296 $('customize-sync-preferences').querySelectorAll('input');
294 for (var i = 0; i < configureElements.length; i++) 297 for (var i = 0; i < configureElements.length; i++)
295 configureElements[i].disabled = disabled; 298 configureElements[i].disabled = disabled;
296 $('sync-select-datatypes').disabled = disabled; 299 $('sync-select-datatypes').disabled = disabled;
297 300
298 $('customize-link').hidden = disabled; 301 $('customize-link').hidden = disabled;
299 $('customize-link').disabled = disabled; 302 $('customize-link').disabled = disabled;
300 $('customize-link').onclick = disabled ? null : function() { 303 $('customize-link').onclick = disabled ? null : function() {
301 SyncSetupOverlay.showCustomizePage(self.syncConfigureArgs_, 304 SyncSetupOverlay.showCustomizePage(self.syncConfigureArgs_,
302 DataTypeSelection.SYNC_EVERYTHING); 305 options.DataTypeSelection.SYNC_EVERYTHING);
303 return false; 306 return false;
304 }; 307 };
305 }, 308 },
306 309
307 /** 310 /**
308 * Shows or hides the sync data type checkboxes in the advanced sync 311 * Shows or hides the sync data type checkboxes in the advanced sync
309 * settings dialog. Also initializes |dataTypeBoxesChecked_| and 312 * settings dialog. Also initializes |dataTypeBoxesChecked_| and
310 * |dataTypeBoxedDisabled_| with their values, and makes their onclick 313 * |dataTypeBoxedDisabled_| with their values, and makes their onclick
311 * handlers update |dataTypeBoxesChecked_|. 314 * handlers update |dataTypeBoxesChecked_|.
312 * @param {Object} args The configuration data used to show/hide UI. 315 * @param {Object} args The configuration data used to show/hide UI.
313 * @private 316 * @private
314 */ 317 */
315 setChooseDataTypesCheckboxes_: function(args) { 318 setChooseDataTypesCheckboxes_: function(args) {
316 var datatypeSelect = $('sync-select-datatypes'); 319 var datatypeSelect = $('sync-select-datatypes');
317 datatypeSelect.selectedIndex = args.syncAllDataTypes ? 320 datatypeSelect.selectedIndex = args.syncAllDataTypes ?
318 DataTypeSelection.SYNC_EVERYTHING : 321 options.DataTypeSelection.SYNC_EVERYTHING :
319 DataTypeSelection.CHOOSE_WHAT_TO_SYNC; 322 options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC;
320 323
321 $('bookmarks-checkbox').checked = args.bookmarksSynced; 324 $('bookmarks-checkbox').checked = args.bookmarksSynced;
322 dataTypeBoxesChecked_['bookmarks-checkbox'] = args.bookmarksSynced; 325 dataTypeBoxesChecked_['bookmarks-checkbox'] = args.bookmarksSynced;
323 dataTypeBoxesDisabled_['bookmarks-checkbox'] = args.bookmarksEnforced; 326 dataTypeBoxesDisabled_['bookmarks-checkbox'] = args.bookmarksEnforced;
324 $('bookmarks-checkbox').onclick = this.handleDataTypeClick_; 327 $('bookmarks-checkbox').onclick = this.handleDataTypeClick_;
325 328
326 $('preferences-checkbox').checked = args.preferencesSynced; 329 $('preferences-checkbox').checked = args.preferencesSynced;
327 dataTypeBoxesChecked_['preferences-checkbox'] = args.preferencesSynced; 330 dataTypeBoxesChecked_['preferences-checkbox'] = args.preferencesSynced;
328 dataTypeBoxesDisabled_['preferences-checkbox'] = args.preferencesEnforced; 331 dataTypeBoxesDisabled_['preferences-checkbox'] = args.preferencesEnforced;
329 $('preferences-checkbox').onclick = this.handleDataTypeClick_; 332 $('preferences-checkbox').onclick = this.handleDataTypeClick_;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Once the advanced sync settings dialog is visible, we transition 438 // Once the advanced sync settings dialog is visible, we transition
436 // between its drop-down menu items as follows: 439 // between its drop-down menu items as follows:
437 // "Sync everything": Show encryption and passphrase sections, and disable 440 // "Sync everything": Show encryption and passphrase sections, and disable
438 // and check all data type checkboxes. 441 // and check all data type checkboxes.
439 // "Sync nothing": Hide encryption and passphrase sections, and disable 442 // "Sync nothing": Hide encryption and passphrase sections, and disable
440 // and uncheck all data type checkboxes. 443 // and uncheck all data type checkboxes.
441 // "Choose what to sync": Show encryption and passphrase sections, enable 444 // "Choose what to sync": Show encryption and passphrase sections, enable
442 // data type checkboxes, and restore their checked state to the last time 445 // data type checkboxes, and restore their checked state to the last time
443 // the "Choose what to sync" was selected while the dialog was still up. 446 // the "Choose what to sync" was selected while the dialog was still up.
444 datatypeSelect.onchange = function() { 447 datatypeSelect.onchange = function() {
445 if (this.selectedIndex == DataTypeSelection.SYNC_NOTHING) { 448 if (this.selectedIndex == options.DataTypeSelection.SYNC_NOTHING) {
446 self.showSyncNothingPage_(); 449 self.showSyncNothingPage_();
447 } else { 450 } else {
448 self.showCustomizePage_(self.syncConfigureArgs_, this.selectedIndex); 451 self.showCustomizePage_(self.syncConfigureArgs_, this.selectedIndex);
449 if (this.selectedIndex == DataTypeSelection.SYNC_EVERYTHING) 452 if (this.selectedIndex == options.DataTypeSelection.SYNC_EVERYTHING)
450 self.checkAllDataTypeCheckboxes_(true); 453 self.checkAllDataTypeCheckboxes_(true);
451 else 454 else
452 self.restoreDataTypeCheckboxes_(); 455 self.restoreDataTypeCheckboxes_();
453 } 456 }
454 }; 457 };
455 458
456 this.resetPage_('sync-setup-configure'); 459 this.resetPage_('sync-setup-configure');
457 $('sync-setup-configure').hidden = false; 460 $('sync-setup-configure').hidden = false;
458 461
459 // onsubmit is changed when submitting a passphrase. Reset it to its 462 // onsubmit is changed when submitting a passphrase. Reset it to its
460 // default. 463 // default.
461 $('choose-data-types-form').onsubmit = function() { 464 $('choose-data-types-form').onsubmit = function() {
462 self.sendConfiguration_(); 465 self.sendConfiguration_();
463 return false; 466 return false;
464 }; 467 };
465 468
466 if (args) { 469 if (args) {
467 this.setCheckboxesAndErrors_(args); 470 this.setCheckboxesAndErrors_(args);
468 471
469 this.useEncryptEverything_ = args.encryptAllData; 472 this.useEncryptEverything_ = args.encryptAllData;
470 473
471 // Determine whether to display the 'OK, sync everything' confirmation 474 // Determine whether to display the 'OK, sync everything' confirmation
472 // dialog or the advanced sync settings dialog, and assign focus to the 475 // dialog or the advanced sync settings dialog, and assign focus to the
473 // OK button, or to the passphrase field if a passphrase is required. 476 // OK button, or to the passphrase field if a passphrase is required.
474 this.usePassphrase_ = args.usePassphrase; 477 this.usePassphrase_ = args.usePassphrase;
475 if (args.showSyncEverythingPage == false || this.usePassphrase_ || 478 if (args.showSyncEverythingPage == false || this.usePassphrase_ ||
476 args.syncAllDataTypes == false || args.showPassphrase) { 479 args.syncAllDataTypes == false || args.showPassphrase) {
477 var index = args.syncAllDataTypes ? 480 var index = args.syncAllDataTypes ?
478 DataTypeSelection.SYNC_EVERYTHING : 481 options.DataTypeSelection.SYNC_EVERYTHING :
479 DataTypeSelection.CHOOSE_WHAT_TO_SYNC; 482 options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC;
480 this.showCustomizePage_(args, index); 483 this.showCustomizePage_(args, index);
481 } else { 484 } else {
482 this.showSyncEverythingPage_(); 485 this.showSyncEverythingPage_();
483 } 486 }
484 } 487 }
485 }, 488 },
486 489
487 showSpinner_: function() { 490 showSpinner_: function() {
488 this.resetPage_('sync-setup-spinner'); 491 this.resetPage_('sync-setup-spinner');
489 $('sync-setup-spinner').hidden = false; 492 $('sync-setup-spinner').hidden = false;
(...skipping 13 matching lines...) Expand all
503 this.confirmPageVisible_ = true; 506 this.confirmPageVisible_ = true;
504 this.customizePageVisible_ = false; 507 this.customizePageVisible_ = false;
505 508
506 $('confirm-sync-preferences').hidden = false; 509 $('confirm-sync-preferences').hidden = false;
507 $('customize-sync-preferences').hidden = true; 510 $('customize-sync-preferences').hidden = true;
508 511
509 // Reset the selection to 'Sync everything'. 512 // Reset the selection to 'Sync everything'.
510 $('sync-select-datatypes').selectedIndex = 0; 513 $('sync-select-datatypes').selectedIndex = 0;
511 514
512 // The default state is to sync everything. 515 // The default state is to sync everything.
513 this.setDataTypeCheckboxes_(DataTypeSelection.SYNC_EVERYTHING); 516 this.setDataTypeCheckboxes_(options.DataTypeSelection.SYNC_EVERYTHING);
514 517
515 if (!this.usePassphrase_) 518 if (!this.usePassphrase_)
516 $('sync-custom-passphrase').hidden = true; 519 $('sync-custom-passphrase').hidden = true;
517 520
518 if (!this.useEncryptEverything_ && !this.usePassphrase_) 521 if (!this.useEncryptEverything_ && !this.usePassphrase_)
519 $('basic-encryption-option').checked = true; 522 $('basic-encryption-option').checked = true;
520 523
521 // Give the OK button focus only when the dialog wasn't already visible. 524 // Give the OK button focus only when the dialog wasn't already visible.
522 if (wasConfirmPageHidden) 525 if (wasConfirmPageHidden)
523 $('confirm-everything-ok').focus(); 526 $('confirm-everything-ok').focus();
524 }, 527 },
525 528
526 /** 529 /**
527 * Reveals the UI for when the user chooses not to sync any data types. 530 * Reveals the UI for when the user chooses not to sync any data types.
528 * This happens when the user signs in and selects "Sync nothing" in the 531 * This happens when the user signs in and selects "Sync nothing" in the
529 * advanced sync settings dialog. 532 * advanced sync settings dialog.
530 * @private 533 * @private
531 */ 534 */
532 showSyncNothingPage_: function() { 535 showSyncNothingPage_: function() {
533 // Reset the selection to 'Sync nothing'. 536 // Reset the selection to 'Sync nothing'.
534 $('sync-select-datatypes').selectedIndex = DataTypeSelection.SYNC_NOTHING; 537 $('sync-select-datatypes').selectedIndex =
538 options.DataTypeSelection.SYNC_NOTHING;
535 539
536 // Uncheck and disable the individual data type checkboxes. 540 // Uncheck and disable the individual data type checkboxes.
537 this.checkAllDataTypeCheckboxes_(false); 541 this.checkAllDataTypeCheckboxes_(false);
538 this.setDataTypeCheckboxesEnabled_(false); 542 this.setDataTypeCheckboxesEnabled_(false);
539 543
540 // Hide the encryption section. 544 // Hide the encryption section.
541 $('customize-sync-encryption-new').hidden = true; 545 $('customize-sync-encryption-new').hidden = true;
542 $('sync-custom-passphrase-container').hidden = true; 546 $('sync-custom-passphrase-container').hidden = true;
543 $('sync-existing-passphrase-container').hidden = true; 547 $('sync-existing-passphrase-container').hidden = true;
544 548
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // previously but failed). 588 // previously but failed).
585 $('incorrect-passphrase').hidden = 589 $('incorrect-passphrase').hidden =
586 !(args.usePassphrase && args.passphraseFailed); 590 !(args.usePassphrase && args.passphraseFailed);
587 591
588 $('sync-passphrase-warning').hidden = false; 592 $('sync-passphrase-warning').hidden = false;
589 }, 593 },
590 594
591 /** 595 /**
592 * Displays the advanced sync setting dialog, and pre-selects either the 596 * Displays the advanced sync setting dialog, and pre-selects either the
593 * "Sync everything" or the "Choose what to sync" drop-down menu item. 597 * "Sync everything" or the "Choose what to sync" drop-down menu item.
594 * @param {cr.DataTypeSelection} index Index of item to pre-select. 598 * @param {options.DataTypeSelection} index Index of item to pre-select.
595 * @private 599 * @private
596 */ 600 */
597 showCustomizePage_: function(args, index) { 601 showCustomizePage_: function(args, index) {
598 // Determine whether to bring the OK button field into focus. 602 // Determine whether to bring the OK button field into focus.
599 var wasCustomizePageHidden = !this.customizePageVisible_; 603 var wasCustomizePageHidden = !this.customizePageVisible_;
600 this.customizePageVisible_ = true; 604 this.customizePageVisible_ = true;
601 this.confirmPageVisible_ = false; 605 this.confirmPageVisible_ = false;
602 606
603 $('confirm-sync-preferences').hidden = true; 607 $('confirm-sync-preferences').hidden = true;
604 $('customize-sync-preferences').hidden = false; 608 $('customize-sync-preferences').hidden = false;
605 609
606 $('sync-custom-passphrase-container').hidden = false; 610 $('sync-custom-passphrase-container').hidden = false;
607 $('sync-new-encryption-section-container').hidden = false; 611 $('sync-new-encryption-section-container').hidden = false;
608 $('customize-sync-encryption-new').hidden = args.isSupervised; 612 $('customize-sync-encryption-new').hidden = args.isSupervised;
609 613
610 $('sync-existing-passphrase-container').hidden = true; 614 $('sync-existing-passphrase-container').hidden = true;
611 615
612 $('sync-select-datatypes').selectedIndex = index; 616 $('sync-select-datatypes').selectedIndex = index;
613 this.setDataTypeCheckboxesEnabled_( 617 this.setDataTypeCheckboxesEnabled_(
614 index == DataTypeSelection.CHOOSE_WHAT_TO_SYNC); 618 index == options.DataTypeSelection.CHOOSE_WHAT_TO_SYNC);
615 619
616 // Give the OK button focus only when the dialog wasn't already visible. 620 // Give the OK button focus only when the dialog wasn't already visible.
617 if (wasCustomizePageHidden) 621 if (wasCustomizePageHidden)
618 $('choose-datatypes-ok').focus(); 622 $('choose-datatypes-ok').focus();
619 623
620 if (args.showPassphrase) { 624 if (args.showPassphrase) {
621 this.showPassphraseContainer_(args); 625 this.showPassphraseContainer_(args);
622 // Give the passphrase field focus only when the dialog wasn't already 626 // Give the passphrase field focus only when the dialog wasn't already
623 // visible. 627 // visible.
624 if (wasCustomizePageHidden) 628 if (wasCustomizePageHidden)
625 $('passphrase').focus(); 629 $('passphrase').focus();
626 } else { 630 } else {
627 // We only show the 'Use Default' link if we're not prompting for an 631 // We only show the 'Use Default' link if we're not prompting for an
628 // existing passphrase. 632 // existing passphrase.
629 $('use-default-link').hidden = false; 633 $('use-default-link').hidden = false;
630 $('use-default-link').disabled = false; 634 $('use-default-link').disabled = false;
631 $('use-default-link').onclick = function() { 635 $('use-default-link').onclick = function() {
632 SyncSetupOverlay.showSyncEverythingPage(); 636 SyncSetupOverlay.showSyncEverythingPage();
633 return false; 637 return false;
634 }; 638 };
635 } 639 }
636 }, 640 },
637 641
638 /** 642 /**
639 * Shows the appropriate sync setup page. 643 * Shows the appropriate sync setup page.
640 * @param {string} page A page of the sync setup to show. 644 * @param {string} page A page of the sync setup to show.
641 * @param {object} args Data from the C++ to forward on to the right 645 * @param {Object} args Data from the C++ to forward on to the right
642 * section. 646 * section.
643 */ 647 */
644 showSyncSetupPage_: function(page, args) { 648 showSyncSetupPage_: function(page, args) {
645 // If the user clicks the OK button, dismiss the dialog immediately, and 649 // If the user clicks the OK button, dismiss the dialog immediately, and
646 // do not go through the process of hiding elements of the overlay. 650 // do not go through the process of hiding elements of the overlay.
647 // See crbug.com/308873. 651 // See crbug.com/308873.
648 if (page == 'done') { 652 if (page == 'done') {
649 this.closeOverlay_(); 653 this.closeOverlay_();
650 return; 654 return;
651 } 655 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 var throbbers = this.pageDiv.getElementsByClassName('throbber'); 698 var throbbers = this.pageDiv.getElementsByClassName('throbber');
695 for (var i = 0; i < throbbers.length; i++) 699 for (var i = 0; i < throbbers.length; i++)
696 throbbers[i].style.visibility = visible ? 'visible' : 'hidden'; 700 throbbers[i].style.visibility = visible ? 'visible' : 'hidden';
697 }, 701 },
698 702
699 /** 703 /**
700 * Reset the state of all descendant elements of a root element to their 704 * Reset the state of all descendant elements of a root element to their
701 * initial state. 705 * initial state.
702 * The initial state is specified by adding a class to the descendant 706 * The initial state is specified by adding a class to the descendant
703 * element in sync_setup_overlay.html. 707 * element in sync_setup_overlay.html.
704 * @param {HTMLElement} pageElementId The root page element id. 708 * @param {string} pageElementId The root page element id.
705 * @private 709 * @private
706 */ 710 */
707 resetPage_: function(pageElementId) { 711 resetPage_: function(pageElementId) {
708 var page = $(pageElementId); 712 var page = $(pageElementId);
709 var forEach = function(arr, fn) { 713 var forEach = function(arr, fn) {
710 var length = arr.length; 714 var length = arr.length;
711 for (var i = 0; i < length; i++) { 715 for (var i = 0; i < length; i++) {
712 fn(arr[i]); 716 fn(arr[i]);
713 } 717 }
714 }; 718 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 808
805 SyncSetupOverlay.showStopSyncingUI = function() { 809 SyncSetupOverlay.showStopSyncingUI = function() {
806 SyncSetupOverlay.getInstance().showStopSyncingUI_(); 810 SyncSetupOverlay.getInstance().showStopSyncingUI_();
807 }; 811 };
808 812
809 // Export 813 // Export
810 return { 814 return {
811 SyncSetupOverlay: SyncSetupOverlay 815 SyncSetupOverlay: SyncSetupOverlay
812 }; 816 };
813 }); 817 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698