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

Side by Side Diff: chrome/browser/resources/options/certificate_backup_overlay.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed feedback 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 /** 9 /**
9 * CertificateBackupOverlay class 10 * CertificateBackupOverlay class
10 * Encapsulated handling of the 'enter backup password' overlay page. 11 * Encapsulated handling of the 'enter backup password' overlay page.
11 * @class 12 * @class
12 */ 13 */
13 function CertificateBackupOverlay() { 14 function CertificateBackupOverlay() {
14 OptionsPage.call(this, 'certificateBackupOverlay', 15 Page.call(this, 'certificateBackupOverlay', '', 'certificateBackupOverlay');
15 '',
16 'certificateBackupOverlay');
17 } 16 }
18 17
19 cr.addSingletonGetter(CertificateBackupOverlay); 18 cr.addSingletonGetter(CertificateBackupOverlay);
20 19
21 CertificateBackupOverlay.prototype = { 20 CertificateBackupOverlay.prototype = {
22 __proto__: OptionsPage.prototype, 21 __proto__: Page.prototype,
23 22
24 /** 23 /**
25 * Initializes the page. 24 * Initializes the page.
26 */ 25 */
27 initializePage: function() { 26 initializePage: function() {
28 OptionsPage.prototype.initializePage.call(this); 27 Page.prototype.initializePage.call(this);
29 28
30 var self = this; 29 var self = this;
31 $('certificateBackupCancelButton').onclick = function(event) { 30 $('certificateBackupCancelButton').onclick = function(event) {
32 self.cancelBackup_(); 31 self.cancelBackup_();
33 }; 32 };
34 $('certificateBackupOkButton').onclick = function(event) { 33 $('certificateBackupOkButton').onclick = function(event) {
35 self.finishBackup_(); 34 self.finishBackup_();
36 }; 35 };
37 var onBackupPasswordInput = function(event) { 36 var onBackupPasswordInput = function(event) {
38 self.comparePasswords_(); 37 self.comparePasswords_();
39 }; 38 };
40 $('certificateBackupPassword').oninput = onBackupPasswordInput; 39 $('certificateBackupPassword').oninput = onBackupPasswordInput;
41 $('certificateBackupPassword2').oninput = onBackupPasswordInput; 40 $('certificateBackupPassword2').oninput = onBackupPasswordInput;
42 41
43 self.clearInputFields_(); 42 self.clearInputFields_();
44 }, 43 },
45 44
46 /** 45 /**
47 * Clears any uncommitted input, and dismisses the overlay. 46 * Clears any uncommitted input, and dismisses the overlay.
48 * @private 47 * @private
49 */ 48 */
50 dismissOverlay_: function() { 49 dismissOverlay_: function() {
51 this.clearInputFields_(); 50 this.clearInputFields_();
52 OptionsPage.closeOverlay(); 51 PageManager.closeOverlay();
53 }, 52 },
54 53
55 /** 54 /**
56 * Attempt the Backup operation. 55 * Attempt the Backup operation.
57 * The overlay will be left up with inputs disabled until the backend 56 * The overlay will be left up with inputs disabled until the backend
58 * finishes and dismisses it. 57 * finishes and dismisses it.
59 * @private 58 * @private
60 */ 59 */
61 finishBackup_: function() { 60 finishBackup_: function() {
62 chrome.send('exportPersonalCertificatePasswordSelected', 61 chrome.send('exportPersonalCertificatePasswordSelected',
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 $('certificateBackupPassword2').value = ''; 95 $('certificateBackupPassword2').value = '';
97 $('certificateBackupPassword').disabled = false; 96 $('certificateBackupPassword').disabled = false;
98 $('certificateBackupPassword2').disabled = false; 97 $('certificateBackupPassword2').disabled = false;
99 $('certificateBackupCancelButton').disabled = false; 98 $('certificateBackupCancelButton').disabled = false;
100 $('certificateBackupOkButton').disabled = true; 99 $('certificateBackupOkButton').disabled = true;
101 }, 100 },
102 }; 101 };
103 102
104 CertificateBackupOverlay.show = function() { 103 CertificateBackupOverlay.show = function() {
105 CertificateBackupOverlay.getInstance().clearInputFields_(); 104 CertificateBackupOverlay.getInstance().clearInputFields_();
106 OptionsPage.navigateToPage('certificateBackupOverlay'); 105 PageManager.showPageByName('certificateBackupOverlay');
107 }; 106 };
108 107
109 CertificateBackupOverlay.dismiss = function() { 108 CertificateBackupOverlay.dismiss = function() {
110 CertificateBackupOverlay.getInstance().dismissOverlay_(); 109 CertificateBackupOverlay.getInstance().dismissOverlay_();
111 }; 110 };
112 111
113 // Export 112 // Export
114 return { 113 return {
115 CertificateBackupOverlay: CertificateBackupOverlay 114 CertificateBackupOverlay: CertificateBackupOverlay
116 }; 115 };
117 }); 116 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698