| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-display-overscan-dialog' is the dialog for display overscan | 7 * 'settings-display-overscan-dialog' is the dialog for display overscan |
| 8 * adjustments. | 8 * adjustments. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Keyboard event handler for overscan adjustments. | 27 * Keyboard event handler for overscan adjustments. |
| 28 * @type {?function(!Event)} | 28 * @type {?function(!Event)} |
| 29 * @private | 29 * @private |
| 30 */ | 30 */ |
| 31 keyHandler_: null, | 31 keyHandler_: null, |
| 32 | 32 |
| 33 open: function() { | 33 open: function() { |
| 34 this.keyHandler_ = this.handleKeyEvent_.bind(this); | 34 this.keyHandler_ = this.handleKeyEvent_.bind(this); |
| 35 this.addEventListener('keydown', this.keyHandler_); | 35 // We need to attach the event listener to |window|, not |this| so that |
| 36 // changing focus does not prevent key events from occuring. |
| 37 window.addEventListener('keydown', this.keyHandler_); |
| 36 this.comitted_ = false; | 38 this.comitted_ = false; |
| 37 this.$.dialog.showModal(); | 39 this.$.dialog.showModal(); |
| 40 // Don't focus 'reset' by default. 'Tab' will focus 'OK'. |
| 41 this.$$('#reset').blur(); |
| 38 }, | 42 }, |
| 39 | 43 |
| 40 close: function() { | 44 close: function() { |
| 41 this.removeEventListener('keydown', this.keyHandler_); | 45 window.removeEventListener('keydown', this.keyHandler_); |
| 42 | 46 |
| 43 this.displayId = ''; // Will trigger displayIdChanged_. | 47 this.displayId = ''; // Will trigger displayIdChanged_. |
| 44 | 48 |
| 45 if (this.$.dialog.open) | 49 if (this.$.dialog.open) |
| 46 this.$.dialog.close(); | 50 this.$.dialog.close(); |
| 47 }, | 51 }, |
| 48 | 52 |
| 49 /** @private */ | 53 /** @private */ |
| 50 displayIdChanged_: function(newValue, oldValue) { | 54 displayIdChanged_: function(newValue, oldValue) { |
| 51 if (oldValue && !this.comitted_) { | 55 if (oldValue && !this.comitted_) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 /** @type {!chrome.system.display.Insets} */ var delta = { | 139 /** @type {!chrome.system.display.Insets} */ var delta = { |
| 136 left: x, | 140 left: x, |
| 137 top: y, | 141 top: y, |
| 138 right: x, | 142 right: x, |
| 139 bottom: y, | 143 bottom: y, |
| 140 }; | 144 }; |
| 141 settings.display.systemDisplayApi.overscanCalibrationAdjust( | 145 settings.display.systemDisplayApi.overscanCalibrationAdjust( |
| 142 this.displayId, delta); | 146 this.displayId, delta); |
| 143 } | 147 } |
| 144 }); | 148 }); |
| OLD | NEW |