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. |
Dan Beam
2014/08/06 18:30:54
nit: @extends {cr.ui.pageManager.Page}
michaelpg
2014/08/06 21:58:18
Done.
| |
12 * @class | 12 * @class |
13 */ | 13 */ |
14 function AlertOverlay() { | 14 function AlertOverlay() { |
15 Page.call(this, 'alertOverlay', '', 'alertOverlay'); | 15 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 } | 16 } |
21 | 17 |
22 cr.addSingletonGetter(AlertOverlay); | 18 cr.addSingletonGetter(AlertOverlay); |
23 | 19 |
24 AlertOverlay.prototype = { | 20 AlertOverlay.prototype = { |
25 // Inherit AlertOverlay from Page. | 21 // Inherit AlertOverlay from Page. |
26 __proto__: Page.prototype, | 22 __proto__: Page.prototype, |
27 | 23 |
28 /** | 24 /** |
29 * Whether the page can be shown. Used to make sure the page is only | 25 * 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. | 26 * shown via AlertOverlay.Show(), and not via the address bar. |
31 * @private | 27 * @private |
32 */ | 28 */ |
33 canShow_: false, | 29 canShow_: false, |
34 | 30 |
35 /** @override */ | 31 /** @override */ |
36 initializePage: function() { | 32 initializePage: function() { |
37 Page.prototype.initializePage.call(this); | 33 Page.prototype.initializePage.call(this); |
38 | 34 |
35 // AlertOverlay is special in that it is not tied to one page or overlay. | |
36 this.alwaysOnTop = true; | |
37 | |
39 var self = this; | 38 var self = this; |
40 $('alertOverlayOk').onclick = function(event) { | 39 $('alertOverlayOk').onclick = function(event) { |
41 self.handleOK_(); | 40 self.handleOK_(); |
42 }; | 41 }; |
43 | 42 |
44 $('alertOverlayCancel').onclick = function(event) { | 43 $('alertOverlayCancel').onclick = function(event) { |
45 self.handleCancel_(); | 44 self.handleCancel_(); |
46 }; | 45 }; |
47 }, | 46 }, |
48 | 47 |
(...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 | 137 // Intentionally don't show the URL in the location bar as we don't want |
139 // people trying to navigate here by hand. | 138 // people trying to navigate here by hand. |
140 PageManager.showPageByName('alertOverlay', false); | 139 PageManager.showPageByName('alertOverlay', false); |
141 }; | 140 }; |
142 | 141 |
143 // Export | 142 // Export |
144 return { | 143 return { |
145 AlertOverlay: AlertOverlay | 144 AlertOverlay: AlertOverlay |
146 }; | 145 }; |
147 }); | 146 }); |
OLD | NEW |