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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 | 7 |
8 /** | 8 /** |
9 * AlertOverlay class | 9 * AlertOverlay class |
10 * Encapsulated handling of a generic alert. | 10 * Encapsulated handling of a generic alert. |
11 * @class | 11 * @class |
12 */ | 12 */ |
13 function AlertOverlay() { | 13 function AlertOverlay() { |
14 OptionsPage.call(this, 'alertOverlay', '', 'alertOverlay'); | 14 OptionsPage.call(this, 'alertOverlay', '', 'alertOverlay'); |
15 } | 15 } |
16 | 16 |
17 cr.addSingletonGetter(AlertOverlay); | 17 cr.addSingletonGetter(AlertOverlay); |
18 | 18 |
19 AlertOverlay.prototype = { | 19 AlertOverlay.prototype = { |
20 // Inherit AlertOverlay from OptionsPage. | 20 // Inherit AlertOverlay from OptionsPage. |
21 __proto__: OptionsPage.prototype, | 21 __proto__: OptionsPage.prototype, |
22 | 22 |
23 /** | 23 /** |
24 * Whether the page can be shown. Used to make sure the page is only | 24 * Whether the page can be shown. Used to make sure the page is only |
25 * shown via AlertOverlay.Show(), and not via the address bar. | 25 * shown via AlertOverlay.Show(), and not via the address bar. |
26 * @private | 26 * @private |
27 */ | 27 */ |
28 canShow_: false, | 28 canShow_: false, |
29 | 29 |
30 /** | 30 /** @override */ |
31 * Initialize the page. | |
32 */ | |
33 initializePage: function() { | 31 initializePage: function() { |
34 // Call base class implementation to start preference initialization. | 32 // Call base class implementation to start preference initialization. |
35 OptionsPage.prototype.initializePage.call(this); | 33 OptionsPage.prototype.initializePage.call(this); |
36 | 34 |
37 var self = this; | 35 var self = this; |
38 $('alertOverlayOk').onclick = function(event) { | 36 $('alertOverlayOk').onclick = function(event) { |
39 self.handleOK_(); | 37 self.handleOK_(); |
40 }; | 38 }; |
41 | 39 |
42 $('alertOverlayCancel').onclick = function(event) { | 40 $('alertOverlayCancel').onclick = function(event) { |
(...skipping 28 matching lines...) Expand all Loading... |
71 */ | 69 */ |
72 handleCancel_: function() { | 70 handleCancel_: function() { |
73 OptionsPage.closeOverlay(); | 71 OptionsPage.closeOverlay(); |
74 if (this.cancelCallback != undefined) { | 72 if (this.cancelCallback != undefined) { |
75 this.cancelCallback.call(); | 73 this.cancelCallback.call(); |
76 } | 74 } |
77 }, | 75 }, |
78 | 76 |
79 /** | 77 /** |
80 * The page is getting hidden. Don't let it be shown again. | 78 * The page is getting hidden. Don't let it be shown again. |
| 79 * @override |
81 */ | 80 */ |
82 willHidePage: function() { | 81 willHidePage: function() { |
83 canShow_ = false; | 82 canShow_ = false; |
84 }, | 83 }, |
85 | 84 |
86 /** @override */ | 85 /** @override */ |
87 canShowPage: function() { | 86 canShowPage: function() { |
88 return this.canShow_; | 87 return this.canShow_; |
89 }, | 88 }, |
90 }; | 89 }; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Intentionally don't show the URL in the location bar as we don't want | 142 // Intentionally don't show the URL in the location bar as we don't want |
144 // people trying to navigate here by hand. | 143 // people trying to navigate here by hand. |
145 OptionsPage.showPageByName('alertOverlay', false); | 144 OptionsPage.showPageByName('alertOverlay', false); |
146 }; | 145 }; |
147 | 146 |
148 // Export | 147 // Export |
149 return { | 148 return { |
150 AlertOverlay: AlertOverlay | 149 AlertOverlay: AlertOverlay |
151 }; | 150 }; |
152 }); | 151 }); |
OLD | NEW |