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 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
7 // OptionsPage class: | 7 // OptionsPage class: |
8 | 8 |
9 /** | 9 /** |
10 * Base class for options page. | 10 * Base class for options page. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 */ | 287 */ |
288 OptionsPage.isOverlayVisible_ = function() { | 288 OptionsPage.isOverlayVisible_ = function() { |
289 return this.getVisibleOverlay_() != null; | 289 return this.getVisibleOverlay_() != null; |
290 }; | 290 }; |
291 | 291 |
292 /** | 292 /** |
293 * Returns the currently visible overlay, or null if no page is visible. | 293 * Returns the currently visible overlay, or null if no page is visible. |
294 * @return {OptionPage} The visible overlay. | 294 * @return {OptionPage} The visible overlay. |
295 */ | 295 */ |
296 OptionsPage.getVisibleOverlay_ = function() { | 296 OptionsPage.getVisibleOverlay_ = function() { |
297 var highestPage = null; | |
James Hawkins
2012/02/14 21:55:03
topmostPage
Dan Beam
2012/02/14 21:58:52
Done.
| |
297 for (var name in this.registeredOverlayPages) { | 298 for (var name in this.registeredOverlayPages) { |
298 var page = this.registeredOverlayPages[name]; | 299 var page = this.registeredOverlayPages[name]; |
299 if (page.visible) | 300 if (page.visible && |
300 return page; | 301 (!highestPage || page.nestingLevel > highestPage.nestingLevel)) { |
302 highestPage = page; | |
303 } | |
301 } | 304 } |
302 return null; | 305 return highestPage; |
303 }; | 306 }; |
304 | 307 |
305 /** | 308 /** |
306 * Closes the visible overlay. Updates the history state after closing the | 309 * Closes the visible overlay. Updates the history state after closing the |
307 * overlay. | 310 * overlay. |
308 */ | 311 */ |
309 OptionsPage.closeOverlay = function() { | 312 OptionsPage.closeOverlay = function() { |
310 var overlay = this.getVisibleOverlay_(); | 313 var overlay = this.getVisibleOverlay_(); |
311 if (!overlay) | 314 if (!overlay) |
312 return; | 315 return; |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1099 canShowPage: function() { | 1102 canShowPage: function() { |
1100 return true; | 1103 return true; |
1101 }, | 1104 }, |
1102 }; | 1105 }; |
1103 | 1106 |
1104 // Export | 1107 // Export |
1105 return { | 1108 return { |
1106 OptionsPage: OptionsPage | 1109 OptionsPage: OptionsPage |
1107 }; | 1110 }; |
1108 }); | 1111 }); |
OLD | NEW |