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

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

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage;
7
8 /**
9 * CertificateBackupOverlay class
10 * Encapsulated handling of the 'enter backup password' overlay page.
11 * @class
12 */
13 function CertificateBackupOverlay() {
14 OptionsPage.call(this, 'certificateBackupOverlay',
15 '',
16 'certificateBackupOverlay');
17 }
18
19 cr.addSingletonGetter(CertificateBackupOverlay);
20
21 CertificateBackupOverlay.prototype = {
22 __proto__: OptionsPage.prototype,
23
24 /**
25 * Initializes the page.
26 */
27 initializePage: function() {
28 OptionsPage.prototype.initializePage.call(this);
29
30 var self = this;
31 $('certificateBackupCancelButton').onclick = function(event) {
32 self.cancelBackup_();
33 }
34 $('certificateBackupOkButton').onclick = function(event) {
35 self.finishBackup_();
36 }
37 $('certificateBackupPassword').oninput =
38 $('certificateBackupPassword2').oninput = function(event) {
39 self.comparePasswords_();
40 }
41
42 self.clearInputFields_();
43 },
44
45 /**
46 * Clears any uncommitted input, and dismisses the overlay.
47 * @private
48 */
49 dismissOverlay_: function() {
50 this.clearInputFields_();
51 OptionsPage.closeOverlay();
52 },
53
54 /**
55 * Attempt the Backup operation.
56 * The overlay will be left up with inputs disabled until the backend
57 * finishes and dismisses it.
58 * @private
59 */
60 finishBackup_: function() {
61 chrome.send('exportPersonalCertificatePasswordSelected',
62 [$('certificateBackupPassword').value]);
63 $('certificateBackupCancelButton').disabled = true;
64 $('certificateBackupOkButton').disabled = true;
65 $('certificateBackupPassword').disabled = true;
66 $('certificateBackupPassword2').disabled = true;
67 },
68
69 /**
70 * Cancel the Backup operation.
71 * @private
72 */
73 cancelBackup_: function() {
74 chrome.send('cancelImportExportCertificate');
75 this.dismissOverlay_();
76 },
77
78 /**
79 * Compares the password fields and sets the button state appropriately.
80 * @private
81 */
82 comparePasswords_: function() {
83 var password1 = $('certificateBackupPassword').value;
84 var password2 = $('certificateBackupPassword2').value;
85 $('certificateBackupOkButton').disabled =
86 !password1 || password1 != password2;
87 },
88
89 /**
90 * Clears the value of each input field.
91 * @private
92 */
93 clearInputFields_: function() {
94 $('certificateBackupPassword').value = '';
95 $('certificateBackupPassword2').value = '';
96 $('certificateBackupPassword').disabled = false;
97 $('certificateBackupPassword2').disabled = false;
98 $('certificateBackupCancelButton').disabled = false;
99 $('certificateBackupOkButton').disabled = true;
100 },
101 };
102
103 CertificateBackupOverlay.show = function() {
104 CertificateBackupOverlay.getInstance().clearInputFields_();
105 OptionsPage.navigateToPage('certificateBackupOverlay');
106 };
107
108 CertificateBackupOverlay.dismiss = function() {
109 CertificateBackupOverlay.getInstance().dismissOverlay_();
110 };
111
112 // Export
113 return {
114 CertificateBackupOverlay: CertificateBackupOverlay
115 };
116 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698