| OLD | NEW |
| 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.define('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 // True if the synced account uses a custom passphrase. | 9 // True if the synced account uses a custom passphrase. |
| 10 var usePassphrase_ = false; | 10 var usePassphrase_ = false; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * Sets the disabled property of all input elements within the 'Customize | 277 * Sets the disabled property of all input elements within the 'Customize |
| 278 * Sync Preferences' screen. This is used to prohibit the user from changing | 278 * Sync Preferences' screen. This is used to prohibit the user from changing |
| 279 * the inputs after confirming the customized sync preferences, or resetting | 279 * the inputs after confirming the customized sync preferences, or resetting |
| 280 * the state when re-showing the dialog. | 280 * the state when re-showing the dialog. |
| 281 * @param {boolean} disabled True if controls should be set to disabled. | 281 * @param {boolean} disabled True if controls should be set to disabled. |
| 282 * @private | 282 * @private |
| 283 */ | 283 */ |
| 284 setInputElementsDisabledState_: function(disabled) { | 284 setInputElementsDisabledState_: function(disabled) { |
| 285 var self = this; |
| 285 var configureElements = | 286 var configureElements = |
| 286 $('customize-sync-preferences').querySelectorAll('input'); | 287 $('customize-sync-preferences').querySelectorAll('input'); |
| 287 for (var i = 0; i < configureElements.length; i++) | 288 for (var i = 0; i < configureElements.length; i++) |
| 288 configureElements[i].disabled = disabled; | 289 configureElements[i].disabled = disabled; |
| 289 $('sync-select-datatypes').disabled = disabled; | 290 $('sync-select-datatypes').disabled = disabled; |
| 290 | 291 |
| 291 $('customize-link').hidden = disabled; | 292 $('customize-link').hidden = disabled; |
| 292 $('customize-link').disabled = disabled; | 293 $('customize-link').disabled = disabled; |
| 293 $('customize-link').onclick = disabled ? null : function() { | 294 $('customize-link').onclick = disabled ? null : function() { |
| 294 SyncSetupOverlay.showCustomizePage(null, | 295 SyncSetupOverlay.showCustomizePage(self.syncConfigureArgs_, |
| 295 DataTypeSelection.SYNC_EVERYTHING); | 296 DataTypeSelection.SYNC_EVERYTHING); |
| 296 return false; | 297 return false; |
| 297 }; | 298 }; |
| 298 }, | 299 }, |
| 299 | 300 |
| 300 /** | 301 /** |
| 301 * Shows or hides the sync data type checkboxes in the advanced sync | 302 * Shows or hides the sync data type checkboxes in the advanced sync |
| 302 * settings dialog. Also initializes |dataTypeBoxes_| with their values, and | 303 * settings dialog. Also initializes |dataTypeBoxes_| with their values, and |
| 303 * makes their onclick handlers update |dataTypeBoxes_|. | 304 * makes their onclick handlers update |dataTypeBoxes_|. |
| 304 * @param {Object} args The configuration data used to show/hide UI. | 305 * @param {Object} args The configuration data used to show/hide UI. |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 $('sync-existing-passphrase-container').hidden = true; | 593 $('sync-existing-passphrase-container').hidden = true; |
| 593 | 594 |
| 594 $('sync-select-datatypes').selectedIndex = index; | 595 $('sync-select-datatypes').selectedIndex = index; |
| 595 this.setDataTypeCheckboxesEnabled_( | 596 this.setDataTypeCheckboxesEnabled_( |
| 596 index == DataTypeSelection.CHOOSE_WHAT_TO_SYNC); | 597 index == DataTypeSelection.CHOOSE_WHAT_TO_SYNC); |
| 597 | 598 |
| 598 // Give the OK button focus only when the dialog wasn't already visible. | 599 // Give the OK button focus only when the dialog wasn't already visible. |
| 599 if (wasCustomizePageHidden) | 600 if (wasCustomizePageHidden) |
| 600 $('choose-datatypes-ok').focus(); | 601 $('choose-datatypes-ok').focus(); |
| 601 | 602 |
| 602 if (args && args.showPassphrase) { | 603 if (args.showPassphrase) { |
| 603 this.showPassphraseContainer_(args); | 604 this.showPassphraseContainer_(args); |
| 604 // Give the passphrase field focus only when the dialog wasn't already | 605 // Give the passphrase field focus only when the dialog wasn't already |
| 605 // visible. | 606 // visible. |
| 606 if (wasCustomizePageHidden) | 607 if (wasCustomizePageHidden) |
| 607 $('passphrase').focus(); | 608 $('passphrase').focus(); |
| 608 } else { | 609 } else { |
| 609 // We only show the 'Use Default' link if we're not prompting for an | 610 // We only show the 'Use Default' link if we're not prompting for an |
| 610 // existing passphrase. | 611 // existing passphrase. |
| 611 $('use-default-link').hidden = false; | 612 $('use-default-link').hidden = false; |
| 612 $('use-default-link').disabled = false; | 613 $('use-default-link').disabled = false; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 787 |
| 787 SyncSetupOverlay.showStopSyncingUI = function() { | 788 SyncSetupOverlay.showStopSyncingUI = function() { |
| 788 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 789 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 789 }; | 790 }; |
| 790 | 791 |
| 791 // Export | 792 // Export |
| 792 return { | 793 return { |
| 793 SyncSetupOverlay: SyncSetupOverlay | 794 SyncSetupOverlay: SyncSetupOverlay |
| 794 }; | 795 }; |
| 795 }); | 796 }); |
| OLD | NEW |