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 Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 /** | 9 /** |
10 * AlertOverlay class | 10 * AlertOverlay class |
11 * Encapsulated handling of a generic alert. | 11 * Encapsulated handling of a generic alert. |
12 * @class | 12 * @constructor |
| 13 * @extends {cr.ui.pageManager.Page} |
13 */ | 14 */ |
14 function AlertOverlay() { | 15 function AlertOverlay() { |
15 Page.call(this, 'alertOverlay', '', 'alertOverlay'); | 16 Page.call(this, 'alertOverlay', '', 'alertOverlay'); |
16 // AlertOverlay is special in that it is not tied to one page or overlay. | |
17 // Set the nesting level arbitrarily high so as to always be recognized as | |
18 // the top-most visible page. | |
19 this.nestingLevelOverride = 99; | |
20 } | 17 } |
21 | 18 |
22 cr.addSingletonGetter(AlertOverlay); | 19 cr.addSingletonGetter(AlertOverlay); |
23 | 20 |
24 AlertOverlay.prototype = { | 21 AlertOverlay.prototype = { |
25 // Inherit AlertOverlay from Page. | 22 // Inherit AlertOverlay from Page. |
26 __proto__: Page.prototype, | 23 __proto__: Page.prototype, |
27 | 24 |
28 /** | 25 /** |
29 * Whether the page can be shown. Used to make sure the page is only | 26 * Whether the page can be shown. Used to make sure the page is only |
30 * shown via AlertOverlay.Show(), and not via the address bar. | 27 * shown via AlertOverlay.Show(), and not via the address bar. |
31 * @private | 28 * @private |
32 */ | 29 */ |
33 canShow_: false, | 30 canShow_: false, |
34 | 31 |
35 /** @override */ | 32 /** @override */ |
36 initializePage: function() { | 33 initializePage: function() { |
37 Page.prototype.initializePage.call(this); | 34 Page.prototype.initializePage.call(this); |
38 | 35 |
| 36 // AlertOverlay is special in that it is not tied to one page or overlay. |
| 37 this.alwaysOnTop = true; |
| 38 |
39 var self = this; | 39 var self = this; |
40 $('alertOverlayOk').onclick = function(event) { | 40 $('alertOverlayOk').onclick = function(event) { |
41 self.handleOK_(); | 41 self.handleOK_(); |
42 }; | 42 }; |
43 | 43 |
44 $('alertOverlayCancel').onclick = function(event) { | 44 $('alertOverlayCancel').onclick = function(event) { |
45 self.handleCancel_(); | 45 self.handleCancel_(); |
46 }; | 46 }; |
47 }, | 47 }, |
48 | 48 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Intentionally don't show the URL in the location bar as we don't want | 138 // Intentionally don't show the URL in the location bar as we don't want |
139 // people trying to navigate here by hand. | 139 // people trying to navigate here by hand. |
140 PageManager.showPageByName('alertOverlay', false); | 140 PageManager.showPageByName('alertOverlay', false); |
141 }; | 141 }; |
142 | 142 |
143 // Export | 143 // Export |
144 return { | 144 return { |
145 AlertOverlay: AlertOverlay | 145 AlertOverlay: AlertOverlay |
146 }; | 146 }; |
147 }); | 147 }); |
OLD | NEW |