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

Side by Side Diff: chrome/browser/resources/options2/certificate_restore_overlay.js

Issue 10809005: Options: Rename chrome/browser/resources/options2 -> chrome/browser/resources/options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 /** @const */ var OptionsPage = options.OptionsPage;
7
8 /**
9 * CertificateRestoreOverlay class
10 * Encapsulated handling of the 'enter restore password' overlay page.
11 * @class
12 */
13 function CertificateRestoreOverlay() {
14 OptionsPage.call(this, 'certificateRestore', '',
15 'certificateRestoreOverlay');
16 }
17
18 cr.addSingletonGetter(CertificateRestoreOverlay);
19
20 CertificateRestoreOverlay.prototype = {
21 __proto__: OptionsPage.prototype,
22
23 /**
24 * Initializes the page.
25 */
26 initializePage: function() {
27 OptionsPage.prototype.initializePage.call(this);
28
29 var self = this;
30 $('certificateRestoreCancelButton').onclick = function(event) {
31 self.cancelRestore_();
32 };
33 $('certificateRestoreOkButton').onclick = function(event) {
34 self.finishRestore_();
35 };
36
37 self.clearInputFields_();
38 },
39
40 /** @inheritDoc */
41 didShowPage: function() {
42 $('certificateRestorePassword').focus();
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 restore operation.
56 * The overlay will be left up with inputs disabled until the backend
57 * finishes and dismisses it.
58 * @private
59 */
60 finishRestore_: function() {
61 chrome.send('importPersonalCertificatePasswordSelected',
62 [$('certificateRestorePassword').value]);
63 $('certificateRestoreCancelButton').disabled = true;
64 $('certificateRestoreOkButton').disabled = true;
65 },
66
67 /**
68 * Cancel the restore operation.
69 * @private
70 */
71 cancelRestore_: function() {
72 chrome.send('cancelImportExportCertificate');
73 this.dismissOverlay_();
74 },
75
76 /**
77 * Clears the value of each input field.
78 * @private
79 */
80 clearInputFields_: function() {
81 $('certificateRestorePassword').value = '';
82 $('certificateRestoreCancelButton').disabled = false;
83 $('certificateRestoreOkButton').disabled = false;
84 },
85 };
86
87 CertificateRestoreOverlay.show = function() {
88 CertificateRestoreOverlay.getInstance().clearInputFields_();
89 OptionsPage.navigateToPage('certificateRestore');
90 };
91
92 CertificateRestoreOverlay.dismiss = function() {
93 CertificateRestoreOverlay.getInstance().dismissOverlay_();
94 };
95
96 // Export
97 return {
98 CertificateRestoreOverlay: CertificateRestoreOverlay
99 };
100
101 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698