OLD | NEW |
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 * CertificateRestoreOverlay class | 10 * CertificateRestoreOverlay class |
10 * Encapsulated handling of the 'enter restore password' overlay page. | 11 * Encapsulated handling of the 'enter restore password' overlay page. |
11 * @class | 12 * @class |
12 */ | 13 */ |
13 function CertificateRestoreOverlay() { | 14 function CertificateRestoreOverlay() { |
14 OptionsPage.call(this, 'certificateRestore', '', | 15 Page.call(this, 'certificateRestore', '', 'certificateRestoreOverlay'); |
15 'certificateRestoreOverlay'); | |
16 } | 16 } |
17 | 17 |
18 cr.addSingletonGetter(CertificateRestoreOverlay); | 18 cr.addSingletonGetter(CertificateRestoreOverlay); |
19 | 19 |
20 CertificateRestoreOverlay.prototype = { | 20 CertificateRestoreOverlay.prototype = { |
21 __proto__: OptionsPage.prototype, | 21 __proto__: Page.prototype, |
22 | 22 |
23 /** | 23 /** |
24 * Initializes the page. | 24 * Initializes the page. |
25 */ | 25 */ |
26 initializePage: function() { | 26 initializePage: function() { |
27 OptionsPage.prototype.initializePage.call(this); | 27 Page.prototype.initializePage.call(this); |
28 | 28 |
29 var self = this; | 29 var self = this; |
30 $('certificateRestoreCancelButton').onclick = function(event) { | 30 $('certificateRestoreCancelButton').onclick = function(event) { |
31 self.cancelRestore_(); | 31 self.cancelRestore_(); |
32 }; | 32 }; |
33 $('certificateRestoreOkButton').onclick = function(event) { | 33 $('certificateRestoreOkButton').onclick = function(event) { |
34 self.finishRestore_(); | 34 self.finishRestore_(); |
35 }; | 35 }; |
36 | 36 |
37 self.clearInputFields_(); | 37 self.clearInputFields_(); |
38 }, | 38 }, |
39 | 39 |
40 /** @override */ | 40 /** @override */ |
41 didShowPage: function() { | 41 didShowPage: function() { |
42 $('certificateRestorePassword').focus(); | 42 $('certificateRestorePassword').focus(); |
43 }, | 43 }, |
44 | 44 |
45 /** | 45 /** |
46 * Clears any uncommitted input, and dismisses the overlay. | 46 * Clears any uncommitted input, and dismisses the overlay. |
47 * @private | 47 * @private |
48 */ | 48 */ |
49 dismissOverlay_: function() { | 49 dismissOverlay_: function() { |
50 this.clearInputFields_(); | 50 this.clearInputFields_(); |
51 OptionsPage.closeOverlay(); | 51 PageManager.closeOverlay(); |
52 }, | 52 }, |
53 | 53 |
54 /** | 54 /** |
55 * Attempt the restore operation. | 55 * Attempt the restore operation. |
56 * 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 |
57 * finishes and dismisses it. | 57 * finishes and dismisses it. |
58 * @private | 58 * @private |
59 */ | 59 */ |
60 finishRestore_: function() { | 60 finishRestore_: function() { |
61 chrome.send('importPersonalCertificatePasswordSelected', | 61 chrome.send('importPersonalCertificatePasswordSelected', |
(...skipping 17 matching lines...) Expand all Loading... |
79 */ | 79 */ |
80 clearInputFields_: function() { | 80 clearInputFields_: function() { |
81 $('certificateRestorePassword').value = ''; | 81 $('certificateRestorePassword').value = ''; |
82 $('certificateRestoreCancelButton').disabled = false; | 82 $('certificateRestoreCancelButton').disabled = false; |
83 $('certificateRestoreOkButton').disabled = false; | 83 $('certificateRestoreOkButton').disabled = false; |
84 }, | 84 }, |
85 }; | 85 }; |
86 | 86 |
87 CertificateRestoreOverlay.show = function() { | 87 CertificateRestoreOverlay.show = function() { |
88 CertificateRestoreOverlay.getInstance().clearInputFields_(); | 88 CertificateRestoreOverlay.getInstance().clearInputFields_(); |
89 OptionsPage.navigateToPage('certificateRestore'); | 89 PageManager.showPageByName('certificateRestore'); |
90 }; | 90 }; |
91 | 91 |
92 CertificateRestoreOverlay.dismiss = function() { | 92 CertificateRestoreOverlay.dismiss = function() { |
93 CertificateRestoreOverlay.getInstance().dismissOverlay_(); | 93 CertificateRestoreOverlay.getInstance().dismissOverlay_(); |
94 }; | 94 }; |
95 | 95 |
96 // Export | 96 // Export |
97 return { | 97 return { |
98 CertificateRestoreOverlay: CertificateRestoreOverlay | 98 CertificateRestoreOverlay: CertificateRestoreOverlay |
99 }; | 99 }; |
100 | 100 |
101 }); | 101 }); |
OLD | NEW |