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

Side by Side Diff: chrome/browser/resources/options/chromeos/display_options.js

Issue 1844783002: Only enable mirroring for 2 displays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass mirrorEnabled explicitly, cleanup Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.exportPath('options'); 5 cr.exportPath('options');
6 6
7 /** 7 /**
8 * Enumeration of multi display mode. These values must match the C++ values in 8 * Enumeration of multi display mode. These values must match the C++ values in
9 * ash::DisplayManager. 9 * ash::DisplayManager.
10 * @enum {number} 10 * @enum {number}
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 * @type {boolean} 91 * @type {boolean}
92 * @private 92 * @private
93 */ 93 */
94 unifiedDesktopEnabled_: false, 94 unifiedDesktopEnabled_: false,
95 95
96 /** 96 /**
97 * Whether the unified desktop option should be present. 97 * Whether the unified desktop option should be present.
98 * @type {boolean} 98 * @type {boolean}
99 * @private 99 * @private
100 */ 100 */
101 showUnifiedDesktopOption_: false, 101 unifiedEnabled_: false,
102
103 /**
104 * Whether the mirroring option should be present.
105 * @type {boolean}
106 * @private
107 */
108 mirroredEnabled_: false,
102 109
103 /** 110 /**
104 * The array of current output displays. It also contains the display 111 * The array of current output displays. It also contains the display
105 * rectangles currently rendered on screen. 112 * rectangles currently rendered on screen.
106 * @type {!Array<!options.DisplayInfo>} 113 * @type {!Array<!options.DisplayInfo>}
107 * @private 114 * @private
108 */ 115 */
109 displays_: [], 116 displays_: [],
110 117
111 /** 118 /**
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 for (var i = 0; i < optionTitles.length; i++) 233 for (var i = 0; i < optionTitles.length; i++)
227 optionTitles[i].style.width = maxSize + 'px'; 234 optionTitles[i].style.width = maxSize + 'px';
228 chrome.send('getDisplayInfo'); 235 chrome.send('getDisplayInfo');
229 }, 236 },
230 237
231 /** @override */ 238 /** @override */
232 canShowPage: function() { return this.enabled_; }, 239 canShowPage: function() { return this.enabled_; },
233 240
234 /** 241 /**
235 * Enables or disables the page. When disabled, the page will not be able to 242 * Enables or disables the page. When disabled, the page will not be able to
236 * open, and will close if currently opened. 243 * open, and will close if currently opened. Also sets the enabled states of
237 * @param {boolean} enabled Whether the page should be enabled. 244 * mirrored and unifed desktop.
238 * @param {boolean} showUnifiedDesktop Whether the unified desktop option 245 * @param {boolean} uiEnabled
239 * should be present. 246 * @param {boolean} unifiedEnabled
247 * @param {boolean} mirroredEnabled
240 */ 248 */
241 setEnabled: function(enabled, showUnifiedDesktop) { 249 setEnabled: function(uiEnabled, unifiedEnabled, mirroredEnabled) {
242 this.showUnifiedDesktopOption_ = showUnifiedDesktop; 250 this.unifiedEnabled_ = unifiedEnabled;
243 if (this.enabled_ == enabled) 251 this.mirroredEnabled_ = mirroredEnabled;
252 if (this.enabled_ == uiEnabled)
244 return; 253 return;
245 this.enabled_ = enabled; 254 this.enabled_ = uiEnabled;
246 if (!enabled && this.visible) 255 if (!uiEnabled && this.visible)
247 PageManager.closeOverlay(); 256 PageManager.closeOverlay();
248 }, 257 },
249 258
250 /** 259 /**
251 * Mouse move handler for dragging display rectangle. 260 * Mouse move handler for dragging display rectangle.
252 * @param {Event} e The mouse move event. 261 * @param {Event} e The mouse move event.
253 * @private 262 * @private
254 */ 263 */
255 onMouseMove_: function(e) { 264 onMouseMove_: function(e) {
256 return this.processDragging_(e, {x: e.pageX, y: e.pageY}); 265 return this.processDragging_(e, {x: e.pageX, y: e.pageY});
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 var arrow = $('display-configuration-arrow'); 483 var arrow = $('display-configuration-arrow');
475 arrow.hidden = false; 484 arrow.hidden = false;
476 // Adding 1 px to the position to fit the border line and the border in 485 // Adding 1 px to the position to fit the border line and the border in
477 // arrow precisely. 486 // arrow precisely.
478 arrow.style.top = $('display-configurations').offsetTop - 487 arrow.style.top = $('display-configurations').offsetTop -
479 arrow.offsetHeight / 2 + 'px'; 488 arrow.offsetHeight / 2 + 'px';
480 arrow.style.left = displayLayout.div.offsetLeft + 489 arrow.style.left = displayLayout.div.offsetLeft +
481 displayLayout.div.offsetWidth / 2 - arrow.offsetWidth / 2 + 'px'; 490 displayLayout.div.offsetWidth / 2 - arrow.offsetWidth / 2 + 'px';
482 491
483 $('display-options-set-primary').disabled = display.isPrimary; 492 $('display-options-set-primary').disabled = display.isPrimary;
484 $('display-options-select-mirroring').disabled = 493 $('display-options-select-mirroring').disabled = !this.mirroredEnabled_;
485 (this.displays_.length <= 1 && !this.unifiedDesktopEnabled_);
486 $('selected-display-start-calibrating-overscan').disabled = 494 $('selected-display-start-calibrating-overscan').disabled =
487 display.isInternal; 495 display.isInternal;
488 496
489 var orientation = $('display-options-orientation-selection'); 497 var orientation = $('display-options-orientation-selection');
490 orientation.disabled = this.unifiedDesktopEnabled_; 498 orientation.disabled = this.unifiedDesktopEnabled_;
491 499
492 var orientationOptions = orientation.getElementsByTagName('option'); 500 var orientationOptions = orientation.getElementsByTagName('option');
493 var orientationIndex = Math.floor(display.rotation / 90); 501 var orientationIndex = Math.floor(display.rotation / 90);
494 orientationOptions[orientationIndex].selected = true; 502 orientationOptions[orientationIndex].selected = true;
495 503
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 695
688 this.resetDisplaysView_(); 696 this.resetDisplaysView_();
689 if (this.mirroring_) 697 if (this.mirroring_)
690 this.layoutMirroringDisplays_(); 698 this.layoutMirroringDisplays_();
691 else 699 else
692 this.layoutDisplays_(); 700 this.layoutDisplays_();
693 701
694 $('display-options-select-mirroring').value = 702 $('display-options-select-mirroring').value =
695 mirroring ? 'mirroring' : 'extended'; 703 mirroring ? 'mirroring' : 'extended';
696 704
697 $('display-options-unified-desktop').hidden = 705 $('display-options-unified-desktop').hidden = !this.unifiedEnabled_;
698 !this.showUnifiedDesktopOption_;
699 706
700 $('display-options-toggle-unified-desktop').checked = 707 $('display-options-toggle-unified-desktop').checked =
701 this.unifiedDesktopEnabled_; 708 this.unifiedDesktopEnabled_;
702 709
703 var disableUnifiedDesktopOption = 710 var disableUnifiedDesktopOption =
704 (this.mirroring_ || 711 (this.mirroring_ ||
705 (!this.unifiedDesktopEnabled_ && this.displays_.length == 1)); 712 (!this.unifiedDesktopEnabled_ && this.displays_.length == 1));
706 713
707 $('display-options-toggle-unified-desktop').disabled = 714 $('display-options-toggle-unified-desktop').disabled =
708 disableUnifiedDesktopOption; 715 disableUnifiedDesktopOption;
709 716
710 this.updateSelectedDisplayDescription_(); 717 this.updateSelectedDisplayDescription_();
711 } 718 }
712 }; 719 };
713 720
714 DisplayOptions.setDisplayInfo = function(mode, displays) { 721 DisplayOptions.setDisplayInfo = function(mode, displays) {
715 DisplayOptions.getInstance().onDisplayChanged_(mode, displays); 722 DisplayOptions.getInstance().onDisplayChanged_(mode, displays);
716 }; 723 };
717 724
718 // Export 725 // Export
719 return { 726 return {
720 DisplayOptions: DisplayOptions 727 DisplayOptions: DisplayOptions
721 }; 728 };
722 }); 729 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698