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

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: 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 /** 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 /** @override */ 23 /** @override */
25 initializePage: function() { 24 initializePage: function() {
26 OptionsPage.prototype.initializePage.call(this); 25 Page.prototype.initializePage.call(this);
27 26
28 var self = this; 27 var self = this;
29 $('certificateBackupCancelButton').onclick = function(event) { 28 $('certificateBackupCancelButton').onclick = function(event) {
30 self.cancelBackup_(); 29 self.cancelBackup_();
31 }; 30 };
32 $('certificateBackupOkButton').onclick = function(event) { 31 $('certificateBackupOkButton').onclick = function(event) {
33 self.finishBackup_(); 32 self.finishBackup_();
34 }; 33 };
35 var onBackupPasswordInput = function(event) { 34 var onBackupPasswordInput = function(event) {
36 self.comparePasswords_(); 35 self.comparePasswords_();
37 }; 36 };
38 $('certificateBackupPassword').oninput = onBackupPasswordInput; 37 $('certificateBackupPassword').oninput = onBackupPasswordInput;
39 $('certificateBackupPassword2').oninput = onBackupPasswordInput; 38 $('certificateBackupPassword2').oninput = onBackupPasswordInput;
40 39
41 self.clearInputFields_(); 40 self.clearInputFields_();
42 }, 41 },
43 42
44 /** 43 /**
45 * Clears any uncommitted input, and dismisses the overlay. 44 * Clears any uncommitted input, and dismisses the overlay.
46 * @private 45 * @private
47 */ 46 */
48 dismissOverlay_: function() { 47 dismissOverlay_: function() {
49 this.clearInputFields_(); 48 this.clearInputFields_();
50 OptionsPage.closeOverlay(); 49 PageManager.closeOverlay();
51 }, 50 },
52 51
53 /** 52 /**
54 * Attempt the Backup operation. 53 * Attempt the Backup operation.
55 * The overlay will be left up with inputs disabled until the backend 54 * The overlay will be left up with inputs disabled until the backend
56 * finishes and dismisses it. 55 * finishes and dismisses it.
57 * @private 56 * @private
58 */ 57 */
59 finishBackup_: function() { 58 finishBackup_: function() {
60 chrome.send('exportPersonalCertificatePasswordSelected', 59 chrome.send('exportPersonalCertificatePasswordSelected',
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 $('certificateBackupPassword2').value = ''; 93 $('certificateBackupPassword2').value = '';
95 $('certificateBackupPassword').disabled = false; 94 $('certificateBackupPassword').disabled = false;
96 $('certificateBackupPassword2').disabled = false; 95 $('certificateBackupPassword2').disabled = false;
97 $('certificateBackupCancelButton').disabled = false; 96 $('certificateBackupCancelButton').disabled = false;
98 $('certificateBackupOkButton').disabled = true; 97 $('certificateBackupOkButton').disabled = true;
99 }, 98 },
100 }; 99 };
101 100
102 CertificateBackupOverlay.show = function() { 101 CertificateBackupOverlay.show = function() {
103 CertificateBackupOverlay.getInstance().clearInputFields_(); 102 CertificateBackupOverlay.getInstance().clearInputFields_();
104 OptionsPage.navigateToPage('certificateBackupOverlay'); 103 PageManager.showPageByName('certificateBackupOverlay');
105 }; 104 };
106 105
107 CertificateBackupOverlay.dismiss = function() { 106 CertificateBackupOverlay.dismiss = function() {
108 CertificateBackupOverlay.getInstance().dismissOverlay_(); 107 CertificateBackupOverlay.getInstance().dismissOverlay_();
109 }; 108 };
110 109
111 // Export 110 // Export
112 return { 111 return {
113 CertificateBackupOverlay: CertificateBackupOverlay 112 CertificateBackupOverlay: CertificateBackupOverlay
114 }; 113 };
115 }); 114 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698