| 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 * @group Chrome Settings Elements | 9 * @group Chrome Settings Elements |
| 10 */ | 10 */ |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 /** | 154 /** |
| 155 * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay | 155 * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay |
| 156 * @param {number} immediateSelectedModeIndex | 156 * @param {number} immediateSelectedModeIndex |
| 157 * @return {string} | 157 * @return {string} |
| 158 * @private | 158 * @private |
| 159 */ | 159 */ |
| 160 getResolutionText_: function(selectedDisplay, immediateSelectedModeIndex) { | 160 getResolutionText_: function(selectedDisplay, immediateSelectedModeIndex) { |
| 161 if (this.selectedDisplay.modes.length == 0) { | 161 if (this.selectedDisplay.modes.length == 0) { |
| 162 var widthStr = selectedDisplay.bounds.width.toString(); | 162 var widthStr = selectedDisplay.bounds.width.toString(); |
| 163 var heightStr = selectedDisplay.bounds.height.toString(); | 163 var heightStr = selectedDisplay.bounds.height.toString(); |
| 164 return this.i18n('displayResolutionText', widthStr, heightStr); | 164 return this.i18n('displayResolutionText', [widthStr, heightStr]); |
| 165 } | 165 } |
| 166 if (isNaN(immediateSelectedModeIndex)) | 166 if (isNaN(immediateSelectedModeIndex)) |
| 167 immediateSelectedModeIndex = this.getSelectedModeIndex_(selectedDisplay); | 167 immediateSelectedModeIndex = this.getSelectedModeIndex_(selectedDisplay); |
| 168 var mode = selectedDisplay.modes[immediateSelectedModeIndex]; | 168 var mode = selectedDisplay.modes[immediateSelectedModeIndex]; |
| 169 var best = selectedDisplay.isInternal ? mode.uiScale == 1.0 : mode.isNative; | 169 var best = selectedDisplay.isInternal ? mode.uiScale == 1.0 : mode.isNative; |
| 170 var widthStr = mode.width.toString(); | 170 var widthStr = mode.width.toString(); |
| 171 var heightStr = mode.height.toString(); | 171 var heightStr = mode.height.toString(); |
| 172 if (best) | 172 if (best) |
| 173 return this.i18n('displayResolutionTextBest', widthStr, heightStr); | 173 return this.i18n('displayResolutionTextBest', [widthStr, heightStr]); |
| 174 else if (mode.isNative) | 174 else if (mode.isNative) |
| 175 return this.i18n('displayResolutionTextNative', widthStr, heightStr); | 175 return this.i18n('displayResolutionTextNative', [widthStr, heightStr]); |
| 176 return this.i18n('displayResolutionText', widthStr, heightStr); | 176 return this.i18n('displayResolutionText', [widthStr, heightStr]); |
| 177 }, | 177 }, |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * @param {!{model: !{index: number}, target: !PaperButtonElement}} e | 180 * @param {!{model: !{index: number}, target: !PaperButtonElement}} e |
| 181 * @private | 181 * @private |
| 182 */ | 182 */ |
| 183 onSelectDisplayTap_: function(e) { | 183 onSelectDisplayTap_: function(e) { |
| 184 this.selectedDisplay = this.displays[e.model.index]; | 184 this.selectedDisplay = this.displays[e.model.index]; |
| 185 // Force active in case selected display was clicked. | 185 // Force active in case selected display was clicked. |
| 186 e.target.active = true; | 186 e.target.active = true; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 }, | 273 }, |
| 274 | 274 |
| 275 /** @private */ | 275 /** @private */ |
| 276 setPropertiesCallback_: function() { | 276 setPropertiesCallback_: function() { |
| 277 if (chrome.runtime.lastError) { | 277 if (chrome.runtime.lastError) { |
| 278 console.error( | 278 console.error( |
| 279 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); | 279 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); |
| 280 } | 280 } |
| 281 }, | 281 }, |
| 282 }); | 282 }); |
| OLD | NEW |