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

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

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh just no Created 6 years, 4 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 | Annotate | Revision Log
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.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
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 /** @override */ 62 /** @override */
62 initializePage: function() { 63 initializePage: function() {
63 OptionsPage.prototype.initializePage.call(this); 64 Page.prototype.initializePage.call(this);
64 65
65 var self = this; 66 var self = this;
66 $('basic-encryption-option').onchange = 67 $('basic-encryption-option').onchange =
67 $('full-encryption-option').onchange = function() { 68 $('full-encryption-option').onchange = function() {
68 self.onEncryptionRadioChanged_(); 69 self.onEncryptionRadioChanged_();
69 }; 70 };
70 $('choose-datatypes-cancel').onclick = 71 $('choose-datatypes-cancel').onclick =
71 $('confirm-everything-cancel').onclick = 72 $('confirm-everything-cancel').onclick =
72 $('stop-syncing-cancel').onclick = 73 $('stop-syncing-cancel').onclick =
73 $('sync-spinner-cancel').onclick = function() { 74 $('sync-spinner-cancel').onclick = function() {
74 self.closeOverlay_(); 75 self.closeOverlay_();
75 }; 76 };
76 $('confirm-everything-ok').onclick = function() { 77 $('confirm-everything-ok').onclick = function() {
77 self.sendConfiguration_(); 78 self.sendConfiguration_();
78 }; 79 };
79 $('timeout-ok').onclick = function() { 80 $('timeout-ok').onclick = function() {
80 chrome.send('CloseTimeout'); 81 chrome.send('CloseTimeout');
81 self.closeOverlay_(); 82 self.closeOverlay_();
82 }; 83 };
83 $('stop-syncing-ok').onclick = function() { 84 $('stop-syncing-ok').onclick = function() {
84 var deleteProfile = $('delete-profile') != undefined && 85 var deleteProfile = $('delete-profile') != undefined &&
85 $('delete-profile').checked; 86 $('delete-profile').checked;
86 chrome.send('SyncSetupStopSyncing', [deleteProfile]); 87 chrome.send('SyncSetupStopSyncing', [deleteProfile]);
87 self.closeOverlay_(); 88 self.closeOverlay_();
88 }; 89 };
89 }, 90 },
90 91
91 showOverlay_: function() { 92 showOverlay_: function() {
92 OptionsPage.navigateToPage('syncSetup'); 93 PageManager.showPageByName('syncSetup');
93 }, 94 },
94 95
95 closeOverlay_: function() { 96 closeOverlay_: function() {
96 this.syncConfigureArgs_ = null; 97 this.syncConfigureArgs_ = null;
97 this.dataTypeBoxes_ = {}; 98 this.dataTypeBoxes_ = {};
98 99
99 var overlay = $('sync-setup-overlay'); 100 var overlay = $('sync-setup-overlay');
100 if (!overlay.hidden) 101 if (!overlay.hidden)
101 OptionsPage.closeOverlay(); 102 PageManager.closeOverlay();
102 }, 103 },
103 104
104 /** @override */ 105 /** @override */
105 didShowPage: function() { 106 didShowPage: function() {
106 chrome.send('SyncSetupShowSetupUI'); 107 chrome.send('SyncSetupShowSetupUI');
107 }, 108 },
108 109
109 /** @override */ 110 /** @override */
110 didClosePage: function() { 111 didClosePage: function() {
111 chrome.send('SyncSetupDidClosePage'); 112 chrome.send('SyncSetupDidClosePage');
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 /** 712 /**
712 * Displays the stop syncing dialog. 713 * Displays the stop syncing dialog.
713 * @private 714 * @private
714 */ 715 */
715 showStopSyncingUI_: function() { 716 showStopSyncingUI_: function() {
716 // Hide any visible children of the overlay. 717 // Hide any visible children of the overlay.
717 var overlay = $('sync-setup-overlay'); 718 var overlay = $('sync-setup-overlay');
718 for (var i = 0; i < overlay.children.length; i++) 719 for (var i = 0; i < overlay.children.length; i++)
719 overlay.children[i].hidden = true; 720 overlay.children[i].hidden = true;
720 721
721 // Bypass OptionsPage.navigateToPage because it will call didShowPage 722 // Bypass PageManager.showPageByName because it will call didShowPage
722 // which will set its own visible page, based on the flow state. 723 // which will set its own visible page, based on the flow state.
723 this.visible = true; 724 this.visible = true;
724 725
725 $('sync-setup-stop-syncing').hidden = false; 726 $('sync-setup-stop-syncing').hidden = false;
726 $('stop-syncing-cancel').focus(); 727 $('stop-syncing-cancel').focus();
727 }, 728 },
728 729
729 /** 730 /**
730 * Determines the appropriate page to show in the Sync Setup UI based on 731 * Determines the appropriate page to show in the Sync Setup UI based on
731 * the state of the Sync backend. Does nothing if the user is not signed in. 732 * 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
785 786
786 SyncSetupOverlay.showStopSyncingUI = function() { 787 SyncSetupOverlay.showStopSyncingUI = function() {
787 SyncSetupOverlay.getInstance().showStopSyncingUI_(); 788 SyncSetupOverlay.getInstance().showStopSyncingUI_();
788 }; 789 };
789 790
790 // Export 791 // Export
791 return { 792 return {
792 SyncSetupOverlay: SyncSetupOverlay 793 SyncSetupOverlay: SyncSetupOverlay
793 }; 794 };
794 }); 795 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/website_settings.js ('k') | chrome/browser/ui/webui/options/manage_profile_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698