| 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 while (this.isOverlayVisible_()) { |
| 354 this.closeOverlay(); |
| 355 } |
| 356 }; |
| 357 |
| 358 /** |
| 350 * Cancels (closes) the overlay, due to the user pressing <Esc>. | 359 * Cancels (closes) the overlay, due to the user pressing <Esc>. |
| 351 */ | 360 */ |
| 352 OptionsPage.cancelOverlay = function() { | 361 OptionsPage.cancelOverlay = function() { |
| 353 // Blur the active element to ensure any changed pref value is saved. | 362 // Blur the active element to ensure any changed pref value is saved. |
| 354 document.activeElement.blur(); | 363 document.activeElement.blur(); |
| 355 var overlay = this.getVisibleOverlay_(); | 364 var overlay = this.getVisibleOverlay_(); |
| 356 // Let the overlay handle the <Esc> if it wants to. | 365 // Let the overlay handle the <Esc> if it wants to. |
| 357 if (overlay.handleCancel) { | 366 if (overlay.handleCancel) { |
| 358 overlay.handleCancel(); | 367 overlay.handleCancel(); |
| 359 this.restoreLastFocusedElement_(); | 368 this.restoreLastFocusedElement_(); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 canShowPage: function() { | 1011 canShowPage: function() { |
| 1003 return true; | 1012 return true; |
| 1004 }, | 1013 }, |
| 1005 }; | 1014 }; |
| 1006 | 1015 |
| 1007 // Export | 1016 // Export |
| 1008 return { | 1017 return { |
| 1009 OptionsPage: OptionsPage | 1018 OptionsPage: OptionsPage |
| 1010 }; | 1019 }; |
| 1011 }); | 1020 }); |
| OLD | NEW |