| 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 Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 7 | 8 |
| 8 // True if the synced account uses a custom passphrase. | 9 // True if the synced account uses a custom passphrase. |
| 9 var usePassphrase_ = false; | 10 var usePassphrase_ = false; |
| 10 | 11 |
| 11 // True if the synced account uses 'encrypt everything'. | 12 // True if the synced account uses 'encrypt everything'. |
| 12 var useEncryptEverything_ = false; | 13 var useEncryptEverything_ = false; |
| 13 | 14 |
| 14 // An object used as a cache of the arguments passed in while initially | 15 // An object used as a cache of the arguments passed in while initially |
| 15 // displaying the advanced sync settings dialog. Used to switch between the | 16 // displaying the advanced sync settings dialog. Used to switch between the |
| 16 // options in the main drop-down menu. Reset when the dialog is closed. | 17 // options in the main drop-down menu. Reset when the dialog is closed. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 CHOOSE_WHAT_TO_SYNC: 1, | 42 CHOOSE_WHAT_TO_SYNC: 1, |
| 42 SYNC_NOTHING: 2 | 43 SYNC_NOTHING: 2 |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * SyncSetupOverlay class | 47 * SyncSetupOverlay class |
| 47 * Encapsulated handling of the 'Sync Setup' overlay page. | 48 * Encapsulated handling of the 'Sync Setup' overlay page. |
| 48 * @class | 49 * @class |
| 49 */ | 50 */ |
| 50 function SyncSetupOverlay() { | 51 function SyncSetupOverlay() { |
| 51 OptionsPage.call(this, 'syncSetup', | 52 Page.call(this, 'syncSetup', |
| 52 loadTimeData.getString('syncSetupOverlayTabTitle'), | 53 loadTimeData.getString('syncSetupOverlayTabTitle'), |
| 53 'sync-setup-overlay'); | 54 'sync-setup-overlay'); |
| 54 } | 55 } |
| 55 | 56 |
| 56 cr.addSingletonGetter(SyncSetupOverlay); | 57 cr.addSingletonGetter(SyncSetupOverlay); |
| 57 | 58 |
| 58 SyncSetupOverlay.prototype = { | 59 SyncSetupOverlay.prototype = { |
| 59 __proto__: OptionsPage.prototype, | 60 __proto__: Page.prototype, |
| 60 | 61 |
| 61 /** | 62 /** |
| 62 * Initializes the page. | 63 * Initializes the page. |
| 63 */ | 64 */ |
| 64 initializePage: function() { | 65 initializePage: function() { |
| 65 OptionsPage.prototype.initializePage.call(this); | 66 Page.prototype.initializePage.call(this); |
| 66 | 67 |
| 67 var self = this; | 68 var self = this; |
| 68 $('basic-encryption-option').onchange = | 69 $('basic-encryption-option').onchange = |
| 69 $('full-encryption-option').onchange = function() { | 70 $('full-encryption-option').onchange = function() { |
| 70 self.onEncryptionRadioChanged_(); | 71 self.onEncryptionRadioChanged_(); |
| 71 } | 72 } |
| 72 $('choose-datatypes-cancel').onclick = | 73 $('choose-datatypes-cancel').onclick = |
| 73 $('confirm-everything-cancel').onclick = | 74 $('confirm-everything-cancel').onclick = |
| 74 $('stop-syncing-cancel').onclick = | 75 $('stop-syncing-cancel').onclick = |
| 75 $('sync-spinner-cancel').onclick = function() { | 76 $('sync-spinner-cancel').onclick = function() { |
| 76 self.closeOverlay_(); | 77 self.closeOverlay_(); |
| 77 }; | 78 }; |
| 78 $('confirm-everything-ok').onclick = function() { | 79 $('confirm-everything-ok').onclick = function() { |
| 79 self.sendConfiguration_(); | 80 self.sendConfiguration_(); |
| 80 }; | 81 }; |
| 81 $('timeout-ok').onclick = function() { | 82 $('timeout-ok').onclick = function() { |
| 82 chrome.send('CloseTimeout'); | 83 chrome.send('CloseTimeout'); |
| 83 self.closeOverlay_(); | 84 self.closeOverlay_(); |
| 84 }; | 85 }; |
| 85 $('stop-syncing-ok').onclick = function() { | 86 $('stop-syncing-ok').onclick = function() { |
| 86 var deleteProfile = $('delete-profile') != undefined && | 87 var deleteProfile = $('delete-profile') != undefined && |
| 87 $('delete-profile').checked; | 88 $('delete-profile').checked; |
| 88 chrome.send('SyncSetupStopSyncing', [deleteProfile]); | 89 chrome.send('SyncSetupStopSyncing', [deleteProfile]); |
| 89 self.closeOverlay_(); | 90 self.closeOverlay_(); |
| 90 }; | 91 }; |
| 91 }, | 92 }, |
| 92 | 93 |
| 93 showOverlay_: function() { | 94 showOverlay_: function() { |
| 94 OptionsPage.navigateToPage('syncSetup'); | 95 PageManager.showPageByName('syncSetup'); |
| 95 }, | 96 }, |
| 96 | 97 |
| 97 closeOverlay_: function() { | 98 closeOverlay_: function() { |
| 98 this.syncConfigureArgs_ = null; | 99 this.syncConfigureArgs_ = null; |
| 99 this.dataTypeBoxes_ = {}; | 100 this.dataTypeBoxes_ = {}; |
| 100 | 101 |
| 101 var overlay = $('sync-setup-overlay'); | 102 var overlay = $('sync-setup-overlay'); |
| 102 if (!overlay.hidden) | 103 if (!overlay.hidden) |
| 103 OptionsPage.closeOverlay(); | 104 PageManager.closeOverlay(); |
| 104 }, | 105 }, |
| 105 | 106 |
| 106 /** @override */ | 107 /** @override */ |
| 107 didShowPage: function() { | 108 didShowPage: function() { |
| 108 chrome.send('SyncSetupShowSetupUI'); | 109 chrome.send('SyncSetupShowSetupUI'); |
| 109 }, | 110 }, |
| 110 | 111 |
| 111 /** @override */ | 112 /** @override */ |
| 112 didClosePage: function() { | 113 didClosePage: function() { |
| 113 chrome.send('SyncSetupDidClosePage'); | 114 chrome.send('SyncSetupDidClosePage'); |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 /** | 714 /** |
| 714 * Displays the stop syncing dialog. | 715 * Displays the stop syncing dialog. |
| 715 * @private | 716 * @private |
| 716 */ | 717 */ |
| 717 showStopSyncingUI_: function() { | 718 showStopSyncingUI_: function() { |
| 718 // Hide any visible children of the overlay. | 719 // Hide any visible children of the overlay. |
| 719 var overlay = $('sync-setup-overlay'); | 720 var overlay = $('sync-setup-overlay'); |
| 720 for (var i = 0; i < overlay.children.length; i++) | 721 for (var i = 0; i < overlay.children.length; i++) |
| 721 overlay.children[i].hidden = true; | 722 overlay.children[i].hidden = true; |
| 722 | 723 |
| 723 // Bypass OptionsPage.navigateToPage because it will call didShowPage | 724 // Bypass PageManager.showPageByName because it will call didShowPage |
| 724 // which will set its own visible page, based on the flow state. | 725 // which will set its own visible page, based on the flow state. |
| 725 this.visible = true; | 726 this.visible = true; |
| 726 | 727 |
| 727 $('sync-setup-stop-syncing').hidden = false; | 728 $('sync-setup-stop-syncing').hidden = false; |
| 728 $('stop-syncing-cancel').focus(); | 729 $('stop-syncing-cancel').focus(); |
| 729 }, | 730 }, |
| 730 | 731 |
| 731 /** | 732 /** |
| 732 * Determines the appropriate page to show in the Sync Setup UI based on | 733 * Determines the appropriate page to show in the Sync Setup UI based on |
| 733 * the state of the Sync backend. Does nothing if the user is not signed in. | 734 * the state of the Sync backend. Does nothing if the user is not signed in. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 788 |
| 788 SyncSetupOverlay.showStopSyncingUI = function() { | 789 SyncSetupOverlay.showStopSyncingUI = function() { |
| 789 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 790 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
| 790 }; | 791 }; |
| 791 | 792 |
| 792 // Export | 793 // Export |
| 793 return { | 794 return { |
| 794 SyncSetupOverlay: SyncSetupOverlay | 795 SyncSetupOverlay: SyncSetupOverlay |
| 795 }; | 796 }; |
| 796 }); | 797 }); |
| OLD | NEW |