OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 if (this.isOverlayVisible_() && | 453 if (this.isOverlayVisible_() && |
454 !this.registeredOverlayPages[data.pageName.toLowerCase()]) { | 454 !this.registeredOverlayPages[data.pageName.toLowerCase()]) { |
455 this.hideOverlay_(); | 455 this.hideOverlay_(); |
456 } | 456 } |
457 | 457 |
458 this.showPageByName(data.pageName, false); | 458 this.showPageByName(data.pageName, false); |
459 } | 459 } |
460 }; | 460 }; |
461 | 461 |
462 /** | 462 /** |
| 463 * Callback for window.onbeforeunload. Used to notify overlays that they will |
| 464 * be closed. |
| 465 */ |
| 466 OptionsPage.willClose = function() { |
| 467 var overlay = this.getVisibleOverlay_(); |
| 468 if (overlay && overlay.didClosePage) |
| 469 overlay.didClosePage(); |
| 470 }; |
| 471 |
| 472 /** |
463 * Freezes/unfreezes the scroll position of given level's page container. | 473 * Freezes/unfreezes the scroll position of given level's page container. |
464 * @param {boolean} freeze Whether the page should be frozen. | 474 * @param {boolean} freeze Whether the page should be frozen. |
465 * @param {number} level The level to freeze/unfreeze. | 475 * @param {number} level The level to freeze/unfreeze. |
466 * @private | 476 * @private |
467 */ | 477 */ |
468 OptionsPage.setPageFrozenAtLevel_ = function(freeze, level) { | 478 OptionsPage.setPageFrozenAtLevel_ = function(freeze, level) { |
469 var container = level == 0 ? $('toplevel-page-container') | 479 var container = level == 0 ? $('toplevel-page-container') |
470 : $('subpage-sheet-container-' + level); | 480 : $('subpage-sheet-container-' + level); |
471 | 481 |
472 if (container.classList.contains('frozen') == freeze) | 482 if (container.classList.contains('frozen') == freeze) |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 shouldClose: function() { | 999 shouldClose: function() { |
990 return true; | 1000 return true; |
991 }, | 1001 }, |
992 }; | 1002 }; |
993 | 1003 |
994 // Export | 1004 // Export |
995 return { | 1005 return { |
996 OptionsPage: OptionsPage | 1006 OptionsPage: OptionsPage |
997 }; | 1007 }; |
998 }); | 1008 }); |
OLD | NEW |