Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/resources/settings/device_page/display.js

Issue 2654433011: MD Settings: Display: Fix selected display update (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698