| 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 OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 // True if the synced account uses a custom passphrase. | 8 // True if the synced account uses a custom passphrase. |
| 9 var usePassphrase_ = false; | 9 var usePassphrase_ = false; |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 }, | 109 }, |
| 110 | 110 |
| 111 /** @override */ | 111 /** @override */ |
| 112 didClosePage: function() { | 112 didClosePage: function() { |
| 113 chrome.send('SyncSetupDidClosePage'); | 113 chrome.send('SyncSetupDidClosePage'); |
| 114 }, | 114 }, |
| 115 | 115 |
| 116 onEncryptionRadioChanged_: function() { | 116 onEncryptionRadioChanged_: function() { |
| 117 var visible = $('full-encryption-option').checked; | 117 var visible = $('full-encryption-option').checked; |
| 118 $('sync-custom-passphrase').hidden = !visible; | 118 $('sync-custom-passphrase').hidden = !visible; |
| 119 chrome.send('coreOptionsUserMetricsAction', |
| 120 ['Options_SyncSetEncryption']); |
| 119 }, | 121 }, |
| 120 | 122 |
| 121 /** | 123 /** |
| 122 * Sets the checked state of the individual sync data type checkboxes in the | 124 * Sets the checked state of the individual sync data type checkboxes in the |
| 123 * advanced sync settings dialog. | 125 * advanced sync settings dialog. |
| 124 * @param {boolean} value True for checked, false for unchecked. | 126 * @param {boolean} value True for checked, false for unchecked. |
| 125 * @private | 127 * @private |
| 126 */ | 128 */ |
| 127 checkAllDataTypeCheckboxes_: function(value) { | 129 checkAllDataTypeCheckboxes_: function(value) { |
| 128 // Only check / uncheck the visible ones (since there's no way to uncheck | 130 // Only check / uncheck the visible ones (since there's no way to uncheck |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 this.setDataTypeCheckboxes_(datatypeSelect.selectedIndex); | 375 this.setDataTypeCheckboxes_(datatypeSelect.selectedIndex); |
| 374 }, | 376 }, |
| 375 | 377 |
| 376 /** | 378 /** |
| 377 * Updates the cached values of the sync data type checkboxes stored in | 379 * Updates the cached values of the sync data type checkboxes stored in |
| 378 * |dataTypeBoxes_|. Used as an onclick handler for each data type checkbox. | 380 * |dataTypeBoxes_|. Used as an onclick handler for each data type checkbox. |
| 379 * @private | 381 * @private |
| 380 */ | 382 */ |
| 381 handleDataTypeClick_: function() { | 383 handleDataTypeClick_: function() { |
| 382 dataTypeBoxes_[this.id] = this.checked; | 384 dataTypeBoxes_[this.id] = this.checked; |
| 385 chrome.send('coreOptionsUserMetricsAction', |
| 386 ['Options_SyncToggleDataType']); |
| 383 }, | 387 }, |
| 384 | 388 |
| 385 setEncryptionRadios_: function(args) { | 389 setEncryptionRadios_: function(args) { |
| 386 if (!args.encryptAllData && !args.usePassphrase) { | 390 if (!args.encryptAllData && !args.usePassphrase) { |
| 387 $('basic-encryption-option').checked = true; | 391 $('basic-encryption-option').checked = true; |
| 388 } else { | 392 } else { |
| 389 $('full-encryption-option').checked = true; | 393 $('full-encryption-option').checked = true; |
| 390 $('full-encryption-option').disabled = true; | 394 $('full-encryption-option').disabled = true; |
| 391 $('basic-encryption-option').disabled = true; | 395 $('basic-encryption-option').disabled = true; |
| 392 } | 396 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 this.resetPage_('sync-setup-spinner'); | 471 this.resetPage_('sync-setup-spinner'); |
| 468 $('sync-setup-spinner').hidden = false; | 472 $('sync-setup-spinner').hidden = false; |
| 469 }, | 473 }, |
| 470 | 474 |
| 471 showTimeoutPage_: function() { | 475 showTimeoutPage_: function() { |
| 472 this.resetPage_('sync-setup-timeout'); | 476 this.resetPage_('sync-setup-timeout'); |
| 473 $('sync-setup-timeout').hidden = false; | 477 $('sync-setup-timeout').hidden = false; |
| 474 }, | 478 }, |
| 475 | 479 |
| 476 showSyncEverythingPage_: function() { | 480 showSyncEverythingPage_: function() { |
| 481 chrome.send('coreOptionsUserMetricsAction', |
| 482 ['Options_SyncSetDefault']); |
| 483 |
| 477 // Determine whether to bring the OK button into focus. | 484 // Determine whether to bring the OK button into focus. |
| 478 var wasConfirmPageHidden = !this.confirmPageVisible_; | 485 var wasConfirmPageHidden = !this.confirmPageVisible_; |
| 479 this.confirmPageVisible_ = true; | 486 this.confirmPageVisible_ = true; |
| 480 this.customizePageVisible_ = false; | 487 this.customizePageVisible_ = false; |
| 481 | 488 |
| 482 $('confirm-sync-preferences').hidden = false; | 489 $('confirm-sync-preferences').hidden = false; |
| 483 $('customize-sync-preferences').hidden = true; | 490 $('customize-sync-preferences').hidden = true; |
| 484 | 491 |
| 485 // Reset the selection to 'Sync everything'. | 492 // Reset the selection to 'Sync everything'. |
| 486 $('sync-select-datatypes').selectedIndex = 0; | 493 $('sync-select-datatypes').selectedIndex = 0; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 $('stop-syncing-cancel').focus(); | 728 $('stop-syncing-cancel').focus(); |
| 722 }, | 729 }, |
| 723 | 730 |
| 724 /** | 731 /** |
| 725 * Determines the appropriate page to show in the Sync Setup UI based on | 732 * Determines the appropriate page to show in the Sync Setup UI based on |
| 726 * the state of the Sync backend. Does nothing if the user is not signed in. | 733 * the state of the Sync backend. Does nothing if the user is not signed in. |
| 727 * @private | 734 * @private |
| 728 */ | 735 */ |
| 729 showSetupUI_: function() { | 736 showSetupUI_: function() { |
| 730 chrome.send('SyncSetupShowSetupUI'); | 737 chrome.send('SyncSetupShowSetupUI'); |
| 738 chrome.send('coreOptionsUserMetricsAction', ['Options_SyncShowAdvanced']); |
| 731 }, | 739 }, |
| 732 | 740 |
| 733 /** | 741 /** |
| 734 * Starts the signin process for the user. Does nothing if the user is | 742 * Starts the signin process for the user. Does nothing if the user is |
| 735 * already signed in. | 743 * already signed in. |
| 736 * @private | 744 * @private |
| 737 */ | 745 */ |
| 738 startSignIn_: function() { | 746 startSignIn_: function() { |
| 739 chrome.send('SyncSetupStartSignIn'); | 747 chrome.send('SyncSetupStartSignIn'); |
| 740 }, | 748 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 | 787 |
| 780 SyncSetupOverlay.showStopSyncingUI = function() { | 788 SyncSetupOverlay.showStopSyncingUI = function() { |
| 781 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 789 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 782 }; | 790 }; |
| 783 | 791 |
| 784 // Export | 792 // Export |
| 785 return { | 793 return { |
| 786 SyncSetupOverlay: SyncSetupOverlay | 794 SyncSetupOverlay: SyncSetupOverlay |
| 787 }; | 795 }; |
| 788 }); | 796 }); |
| OLD | NEW |