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' is the settings subpage for display settings. | 7 * 'settings-display' is the settings subpage for display settings. |
8 */ | 8 */ |
9 | 9 |
10 cr.define('settings.display', function() { | 10 cr.define('settings.display', function() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 this.selectedModeIndex_ = 0; | 159 this.selectedModeIndex_ = 0; |
160 this.currentSelectedModeIndex_ = 0; | 160 this.currentSelectedModeIndex_ = 0; |
161 return; | 161 return; |
162 } | 162 } |
163 this.modeValues_ = Array.from(Array(numModes).keys()); | 163 this.modeValues_ = Array.from(Array(numModes).keys()); |
164 this.selectedModeIndex_ = this.getSelectedModeIndex_(this.selectedDisplay); | 164 this.selectedModeIndex_ = this.getSelectedModeIndex_(this.selectedDisplay); |
165 this.currentSelectedModeIndex_ = this.selectedModeIndex_; | 165 this.currentSelectedModeIndex_ = this.selectedModeIndex_; |
166 }, | 166 }, |
167 | 167 |
168 /** | 168 /** |
| 169 * Returns true if the given display has touch support and is not an internal |
| 170 * display. If the feature is not enabled via the switch, this will return |
| 171 * false. |
| 172 * @param {!chrome.system.display.DisplayUnitInfo} display Display being |
| 173 * checked for touch support. |
| 174 * @return {boolean} |
| 175 * @private |
| 176 */ |
| 177 showTouchCalibrationSetting_: function(display) { |
| 178 return !display.isInternal && display.hasTouchSupport && |
| 179 loadTimeData.getBoolean('enableTouchCalibrationSetting'); |
| 180 }, |
| 181 |
| 182 /** |
169 * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays | 183 * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays |
170 * @return {boolean} | 184 * @return {boolean} |
171 * @private | 185 * @private |
172 */ | 186 */ |
173 showDisplayTabMenu_: function(displays) { | 187 showDisplayTabMenu_: function(displays) { |
174 return displays.length > 1; | 188 return displays.length > 1; |
175 }, | 189 }, |
176 | 190 |
177 /** | 191 /** |
178 * Returns false if the display select menu has to be hidden. | 192 * Returns false if the display select menu has to be hidden. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 /** | 303 /** |
290 * Handles event when a display tab is selected. | 304 * Handles event when a display tab is selected. |
291 * @param {!{detail: !{item: !{displayId: string}}}} e | 305 * @param {!{detail: !{item: !{displayId: string}}}} e |
292 * @private | 306 * @private |
293 */ | 307 */ |
294 onSelectDisplayTab_: function(e) { | 308 onSelectDisplayTab_: function(e) { |
295 this.onSelectDisplay_({detail: e.detail.item.displayId}); | 309 this.onSelectDisplay_({detail: e.detail.item.displayId}); |
296 }, | 310 }, |
297 | 311 |
298 /** | 312 /** |
| 313 * Handles event when a touch calibration option is selected. |
| 314 * @param {!Event} e |
| 315 * @private |
| 316 */ |
| 317 onTouchCalibrationTap_: function(e) { |
| 318 settings.display.systemDisplayApi.touchCalibrationStart( |
| 319 this.selectedDisplay.id); |
| 320 }, |
| 321 |
| 322 /** |
299 * Handles the event when an option from display select menu is selected. | 323 * Handles the event when an option from display select menu is selected. |
300 * @param {!{target: !HTMLSelectElement}} e | 324 * @param {!{target: !HTMLSelectElement}} e |
301 * @private | 325 * @private |
302 */ | 326 */ |
303 updatePrimaryDisplay_: function(e) { | 327 updatePrimaryDisplay_: function(e) { |
304 /** @const {number} */ var PRIMARY_DISP_IDX = 0; | 328 /** @const {number} */ var PRIMARY_DISP_IDX = 0; |
305 if (!this.selectedDisplay) | 329 if (!this.selectedDisplay) |
306 return; | 330 return; |
307 if (this.selectedDisplay.id == this.primaryDisplayId) | 331 if (this.selectedDisplay.id == this.primaryDisplayId) |
308 return; | 332 return; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 }, | 434 }, |
411 | 435 |
412 /** @private */ | 436 /** @private */ |
413 setPropertiesCallback_: function() { | 437 setPropertiesCallback_: function() { |
414 if (chrome.runtime.lastError) { | 438 if (chrome.runtime.lastError) { |
415 console.error( | 439 console.error( |
416 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); | 440 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); |
417 } | 441 } |
418 }, | 442 }, |
419 }); | 443 }); |
OLD | NEW |