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 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; | 6 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; |
7 | 7 |
8 ///////////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////////// |
9 // OptionsPage class: | 9 // OptionsPage class: |
10 | 10 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 | 340 |
341 overlay.visible = false; | 341 overlay.visible = false; |
342 | 342 |
343 if (overlay.didClosePage) overlay.didClosePage(); | 343 if (overlay.didClosePage) overlay.didClosePage(); |
344 this.updateHistoryState_(false, {ignoreHash: true}); | 344 this.updateHistoryState_(false, {ignoreHash: true}); |
345 | 345 |
346 this.restoreLastFocusedElement_(); | 346 this.restoreLastFocusedElement_(); |
347 }; | 347 }; |
348 | 348 |
349 /** | 349 /** |
350 * Closes all overlays and updates the history after each closed overlay. | |
351 */ | |
352 OptionsPage.closeAllOverlays = function() { | |
353 var overlay = this.getVisibleOverlay_(); | |
354 while (overlay) { | |
Bernhard Bauer
2014/03/10 10:56:17
This could be simplified to:
while (this.isOver
Adrian Kuegel
2014/03/10 11:27:02
Done.
| |
355 this.closeOverlay(); | |
356 overlay = this.getVisibleOverlay_(); | |
357 } | |
358 }; | |
359 | |
360 /** | |
350 * Cancels (closes) the overlay, due to the user pressing <Esc>. | 361 * Cancels (closes) the overlay, due to the user pressing <Esc>. |
351 */ | 362 */ |
352 OptionsPage.cancelOverlay = function() { | 363 OptionsPage.cancelOverlay = function() { |
353 // Blur the active element to ensure any changed pref value is saved. | 364 // Blur the active element to ensure any changed pref value is saved. |
354 document.activeElement.blur(); | 365 document.activeElement.blur(); |
355 var overlay = this.getVisibleOverlay_(); | 366 var overlay = this.getVisibleOverlay_(); |
356 // Let the overlay handle the <Esc> if it wants to. | 367 // Let the overlay handle the <Esc> if it wants to. |
357 if (overlay.handleCancel) { | 368 if (overlay.handleCancel) { |
358 overlay.handleCancel(); | 369 overlay.handleCancel(); |
359 this.restoreLastFocusedElement_(); | 370 this.restoreLastFocusedElement_(); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1002 canShowPage: function() { | 1013 canShowPage: function() { |
1003 return true; | 1014 return true; |
1004 }, | 1015 }, |
1005 }; | 1016 }; |
1006 | 1017 |
1007 // Export | 1018 // Export |
1008 return { | 1019 return { |
1009 OptionsPage: OptionsPage | 1020 OptionsPage: OptionsPage |
1010 }; | 1021 }; |
1011 }); | 1022 }); |
OLD | NEW |