| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 /** | 289 /** |
| 290 * @param {!{detail: string}} e |e.detail| is the id of the selected display. | 290 * @param {!{detail: string}} e |e.detail| is the id of the selected display. |
| 291 * @private | 291 * @private |
| 292 */ | 292 */ |
| 293 onSelectDisplay_: function(e) { | 293 onSelectDisplay_: function(e) { |
| 294 var id = e.detail; | 294 var id = e.detail; |
| 295 for (var i = 0; i < this.displays.length; ++i) { | 295 for (var i = 0; i < this.displays.length; ++i) { |
| 296 var display = this.displays[i]; | 296 var display = this.displays[i]; |
| 297 if (id != display.id) | 297 if (id != display.id) |
| 298 continue; | 298 continue; |
| 299 this.currentSelectedModeIndex_ = -1; | 299 if (this.selectedDisplay != display) { |
| 300 this.selectedDisplay = display; | 300 // Set currentSelectedModeIndex_ to -1 so that getResolutionText_ does |
| 301 // not flicker. selectedDisplayChanged will update selectedModeIndex_ |
| 302 // and currentSelectedModeIndex_ correctly. |
| 303 this.currentSelectedModeIndex_ = -1; |
| 304 this.selectedDisplay = display; |
| 305 } |
| 301 } | 306 } |
| 302 }, | 307 }, |
| 303 | 308 |
| 304 /** | 309 /** |
| 305 * Handles event when a display tab is selected. | 310 * Handles event when a display tab is selected. |
| 306 * @param {!{detail: !{item: !{displayId: string}}}} e | 311 * @param {!{detail: !{item: !{displayId: string}}}} e |
| 307 * @private | 312 * @private |
| 308 */ | 313 */ |
| 309 onSelectDisplayTab_: function(e) { | 314 onSelectDisplayTab_: function(e) { |
| 310 this.onSelectDisplay_({detail: e.detail.item.displayId}); | 315 this.onSelectDisplay_({detail: e.detail.item.displayId}); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 }, | 442 }, |
| 438 | 443 |
| 439 /** @private */ | 444 /** @private */ |
| 440 setPropertiesCallback_: function() { | 445 setPropertiesCallback_: function() { |
| 441 if (chrome.runtime.lastError) { | 446 if (chrome.runtime.lastError) { |
| 442 console.error( | 447 console.error( |
| 443 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); | 448 'setDisplayProperties Error: ' + chrome.runtime.lastError.message); |
| 444 } | 449 } |
| 445 }, | 450 }, |
| 446 }); | 451 }); |
| OLD | NEW |