| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 348 } |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * Cancels (closes) the overlay, due to the user pressing <Esc>. | 352 * Cancels (closes) the overlay, due to the user pressing <Esc>. |
| 353 */ | 353 */ |
| 354 OptionsPage.cancelOverlay = function() { | 354 OptionsPage.cancelOverlay = function() { |
| 355 // Blur the active element to ensure any changed pref value is saved. | 355 // Blur the active element to ensure any changed pref value is saved. |
| 356 document.activeElement.blur(); | 356 document.activeElement.blur(); |
| 357 var overlay = this.getVisibleOverlay_(); | 357 var overlay = this.getVisibleOverlay_(); |
| 358 if (!overlay) |
| 359 return; |
| 358 // Let the overlay handle the <Esc> if it wants to. | 360 // Let the overlay handle the <Esc> if it wants to. |
| 359 if (overlay.handleCancel) { | 361 if (overlay.handleCancel) { |
| 360 overlay.handleCancel(); | 362 overlay.handleCancel(); |
| 361 this.restoreLastFocusedElement_(); | 363 this.restoreLastFocusedElement_(); |
| 362 } else { | 364 } else { |
| 363 this.closeOverlay(); | 365 this.closeOverlay(); |
| 364 } | 366 } |
| 365 }; | 367 }; |
| 366 | 368 |
| 367 /** | 369 /** |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 canShowPage: function() { | 1017 canShowPage: function() { |
| 1016 return true; | 1018 return true; |
| 1017 }, | 1019 }, |
| 1018 }; | 1020 }; |
| 1019 | 1021 |
| 1020 // Export | 1022 // Export |
| 1021 return { | 1023 return { |
| 1022 OptionsPage: OptionsPage | 1024 OptionsPage: OptionsPage |
| 1023 }; | 1025 }; |
| 1024 }); | 1026 }); |
| OLD | NEW |