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