| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Encapsulated handling of the 'DisplayOverscan' page. | 10 * Encapsulated handling of the 'DisplayOverscan' page. |
| 11 * @constructor | 11 * @constructor |
| 12 * @extends {cr.ui.pageManager.Page} | 12 * @extends {cr.ui.pageManager.Page} |
| 13 */ | 13 */ |
| 14 function DisplayOverscan() { | 14 function DisplayOverscan() { |
| 15 Page.call(this, 'displayOverscan', | 15 Page.call( |
| 16 loadTimeData.getString('displayOverscanPageTabTitle'), | 16 this, 'displayOverscan', |
| 17 'display-overscan-page'); | 17 loadTimeData.getString('displayOverscanPageTabTitle'), |
| 18 'display-overscan-page'); |
| 18 } | 19 } |
| 19 | 20 |
| 20 cr.addSingletonGetter(DisplayOverscan); | 21 cr.addSingletonGetter(DisplayOverscan); |
| 21 | 22 |
| 22 DisplayOverscan.prototype = { | 23 DisplayOverscan.prototype = { |
| 23 __proto__: Page.prototype, | 24 __proto__: Page.prototype, |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * The ID of the target display. | 27 * The ID of the target display. |
| 27 * @private {?string} | 28 * @private {?string} |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 this.id_ = id; | 111 this.id_ = id; |
| 111 }, | 112 }, |
| 112 | 113 |
| 113 /** | 114 /** |
| 114 * Key event handler to make the effect of display rectangle. | 115 * Key event handler to make the effect of display rectangle. |
| 115 * @param {Event} event The keyboard event. | 116 * @param {Event} event The keyboard event. |
| 116 * @private | 117 * @private |
| 117 */ | 118 */ |
| 118 handleKeyevent_: function(event) { | 119 handleKeyevent_: function(event) { |
| 119 switch (event.keyCode) { | 120 switch (event.keyCode) { |
| 120 case 37: // left arrow | 121 case 37: // left arrow |
| 121 if (event.shiftKey) | 122 if (event.shiftKey) |
| 122 chrome.send('move', ['horizontal', -1]); | 123 chrome.send('move', ['horizontal', -1]); |
| 123 else | 124 else |
| 124 chrome.send('resize', ['horizontal', -1]); | 125 chrome.send('resize', ['horizontal', -1]); |
| 125 event.preventDefault(); | 126 event.preventDefault(); |
| 126 break; | 127 break; |
| 127 case 38: // up arrow | 128 case 38: // up arrow |
| 128 if (event.shiftKey) | 129 if (event.shiftKey) |
| 129 chrome.send('move', ['vertical', -1]); | 130 chrome.send('move', ['vertical', -1]); |
| 130 else | 131 else |
| 131 chrome.send('resize', ['vertical', -1]); | 132 chrome.send('resize', ['vertical', -1]); |
| 132 event.preventDefault(); | 133 event.preventDefault(); |
| 133 break; | 134 break; |
| 134 case 39: // right arrow | 135 case 39: // right arrow |
| 135 if (event.shiftKey) | 136 if (event.shiftKey) |
| 136 chrome.send('move', ['horizontal', 1]); | 137 chrome.send('move', ['horizontal', 1]); |
| 137 else | 138 else |
| 138 chrome.send('resize', ['horizontal', 1]); | 139 chrome.send('resize', ['horizontal', 1]); |
| 139 event.preventDefault(); | 140 event.preventDefault(); |
| 140 break; | 141 break; |
| 141 case 40: // bottom arrow | 142 case 40: // bottom arrow |
| 142 if (event.shiftKey) | 143 if (event.shiftKey) |
| 143 chrome.send('move', ['vertical', 1]); | 144 chrome.send('move', ['vertical', 1]); |
| 144 else | 145 else |
| 145 chrome.send('resize', ['vertical', 1]); | 146 chrome.send('resize', ['vertical', 1]); |
| 146 event.preventDefault(); | 147 event.preventDefault(); |
| 147 break; | 148 break; |
| 148 } | 149 } |
| 149 } | 150 } |
| 150 }; | 151 }; |
| 151 | 152 |
| 152 DisplayOverscan.onOverscanCanceled = function() { | 153 DisplayOverscan.onOverscanCanceled = function() { |
| 153 DisplayOverscan.getInstance().onOverscanCanceled_(); | 154 DisplayOverscan.getInstance().onOverscanCanceled_(); |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 // Export | 157 // Export |
| 157 return { | 158 return {DisplayOverscan: DisplayOverscan}; |
| 158 DisplayOverscan: DisplayOverscan | |
| 159 }; | |
| 160 }); | 159 }); |
| OLD | NEW |