Chromium Code Reviews| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 } | 147 } |
| 148 return 0; | 148 return 0; |
| 149 }, | 149 }, |
| 150 | 150 |
| 151 /** @private */ | 151 /** @private */ |
| 152 selectedDisplayChanged_: function() { | 152 selectedDisplayChanged_: function() { |
| 153 // Set maxModeIndex first so that the slider updates correctly. | 153 // Set maxModeIndex first so that the slider updates correctly. |
| 154 if (this.selectedDisplay.modes.length == 0) { | 154 if (this.selectedDisplay.modes.length == 0) { |
| 155 this.maxModeIndex_ = 0; | 155 this.maxModeIndex_ = 0; |
| 156 this.selectedModeIndex_ = 0; | 156 this.selectedModeIndex_ = 0; |
| 157 return; | 157 } else { |
| 158 this.maxModeIndex_ = this.selectedDisplay.modes.length - 1; | |
| 159 this.selectedModeIndex_ = | |
| 160 this.getSelectedModeIndex_(this.selectedDisplay); | |
| 158 } | 161 } |
| 159 this.maxModeIndex_ = this.selectedDisplay.modes.length - 1; | 162 this.$.orientation.value = this.selectedDisplay.rotation; |
|
dpapad
2016/10/18 00:14:46
Nit: Since your drodpown is not using dom-repeat,
stevenjb
2016/10/18 00:43:11
Yup. I just finished making this consistent with t
| |
| 160 this.selectedModeIndex_ = this.getSelectedModeIndex_(this.selectedDisplay); | |
| 161 }, | 163 }, |
| 162 | 164 |
| 163 /** | 165 /** |
| 164 * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay | 166 * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay |
| 165 * @param {string} primaryDisplayId | 167 * @param {string} primaryDisplayId |
| 166 * @return {boolean} | 168 * @return {boolean} |
| 167 * @private | 169 * @private |
| 168 */ | 170 */ |
| 169 showMakePrimary_: function(selectedDisplay, primaryDisplayId) { | 171 showMakePrimary_: function(selectedDisplay, primaryDisplayId) { |
| 170 return !!selectedDisplay && selectedDisplay.id != primaryDisplayId; | 172 return !!selectedDisplay && selectedDisplay.id != primaryDisplayId; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 assert(newIndex < this.selectedDisplay.modes.length); | 274 assert(newIndex < this.selectedDisplay.modes.length); |
| 273 /** @type {!chrome.system.display.DisplayProperties} */ var properties = { | 275 /** @type {!chrome.system.display.DisplayProperties} */ var properties = { |
| 274 displayMode: this.selectedDisplay.modes[newIndex] | 276 displayMode: this.selectedDisplay.modes[newIndex] |
| 275 }; | 277 }; |
| 276 settings.display.systemDisplayApi.setDisplayProperties( | 278 settings.display.systemDisplayApi.setDisplayProperties( |
| 277 this.selectedDisplay.id, properties, | 279 this.selectedDisplay.id, properties, |
| 278 this.setPropertiesCallback_.bind(this)); | 280 this.setPropertiesCallback_.bind(this)); |
| 279 }, | 281 }, |
| 280 | 282 |
| 281 /** | 283 /** |
| 282 * @param {!{detail: !{selected: string}}} e | 284 * @param {!{target: !{value: string}}} e |
|
dpapad
2016/10/18 00:14:46
@param {!Event}
stevenjb
2016/10/18 00:43:11
Acknowledged.
| |
| 283 * @private | 285 * @private |
| 284 */ | 286 */ |
| 285 onSetOrientation_: function(e) { | 287 onSetOrientation_: function(e) { |
| 286 /** @type {!chrome.system.display.DisplayProperties} */ var properties = { | 288 /** @type {!chrome.system.display.DisplayProperties} */ var properties = { |
| 287 rotation: parseInt(e.detail.selected, 10) | 289 rotation: parseInt(e.target.value, 10) |
|
dpapad
2016/10/18 00:14:46
Cast to HTMLSelectElement to satisfy the compiler.
stevenjb
2016/10/18 00:43:10
Acknowledged.
| |
| 288 }; | 290 }; |
| 289 settings.display.systemDisplayApi.setDisplayProperties( | 291 settings.display.systemDisplayApi.setDisplayProperties( |
| 290 this.selectedDisplay.id, properties, | 292 this.selectedDisplay.id, properties, |
| 291 this.setPropertiesCallback_.bind(this)); | 293 this.setPropertiesCallback_.bind(this)); |
| 292 }, | 294 }, |
| 293 | 295 |
| 294 /** @private */ | 296 /** @private */ |
| 295 onMirroredTap_: function() { | 297 onMirroredTap_: function() { |
| 296 var id = ''; | 298 var id = ''; |
| 297 /** @type {!chrome.system.display.DisplayProperties} */ var properties = {}; | 299 /** @type {!chrome.system.display.DisplayProperties} */ var properties = {}; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 }, | 342 }, |
| 341 | 343 |
| 342 /** @private */ | 344 /** @private */ |
| 343 setPropertiesCallback_: function() { | 345 setPropertiesCallback_: function() { |
| 344 if (chrome.runtime.lastError) { | 346 if (chrome.runtime.lastError) { |
| 345 console.error( | 347 console.error( |
| 346 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); | 348 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); |
| 347 } | 349 } |
| 348 }, | 350 }, |
| 349 }); | 351 }); |
| OLD | NEW |