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

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

Issue 11818043: Only show start/stop mirroring button when there are multiple displays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Redirect to chrome settings in single display mode. Created 7 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 | Annotate | Revision Log
« 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 (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.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 7
8 // The scale ratio of the display rectangle to its original size. 8 // The scale ratio of the display rectangle to its original size.
9 /** @const */ var VISUAL_SCALE = 1 / 10; 9 /** @const */ var VISUAL_SCALE = 1 / 10;
10 10
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 /** 828 /**
829 * Updates the description of the selected display section. 829 * Updates the description of the selected display section.
830 * @private 830 * @private
831 */ 831 */
832 updateSelectedDisplayDescription_: function() { 832 updateSelectedDisplayDescription_: function() {
833 if (this.focusedIndex_ == null || 833 if (this.focusedIndex_ == null ||
834 this.displays_[this.focusedIndex_] == null) { 834 this.displays_[this.focusedIndex_] == null) {
835 $('selected-display-data-container').hidden = true; 835 $('selected-display-data-container').hidden = true;
836 $('display-configuration-arrow').hidden = true; 836 $('display-configuration-arrow').hidden = true;
837 $('display-options-set-primary').hidden = true; 837 $('display-options-set-primary').hidden = true;
838 $('display-options-toggle-mirroring').hidden = true;
838 return; 839 return;
839 } 840 }
840 841
841 $('selected-display-data-container').hidden = false; 842 $('selected-display-data-container').hidden = false;
842 var display = this.displays_[this.focusedIndex_]; 843 var display = this.displays_[this.focusedIndex_];
843 var nameElement = $('selected-display-name'); 844 var nameElement = $('selected-display-name');
844 while (nameElement.childNodes.length > 0) 845 while (nameElement.childNodes.length > 0)
845 nameElement.removeChild(nameElement.firstChild); 846 nameElement.removeChild(nameElement.firstChild);
846 nameElement.appendChild(document.createTextNode(display.name)); 847 nameElement.appendChild(document.createTextNode(display.name));
847 848
(...skipping 18 matching lines...) Expand all
866 arrow.hidden = false; 867 arrow.hidden = false;
867 // Adding 1 px to the position to fit the border line and the border in 868 // Adding 1 px to the position to fit the border line and the border in
868 // arrow precisely. 869 // arrow precisely.
869 arrow.style.top = $('display-configurations').offsetTop - 870 arrow.style.top = $('display-configurations').offsetTop -
870 arrow.offsetHeight / 2 + 1 + 'px'; 871 arrow.offsetHeight / 2 + 1 + 'px';
871 arrow.style.left = display.div.offsetLeft + display.div.offsetWidth / 2 - 872 arrow.style.left = display.div.offsetLeft + display.div.offsetWidth / 2 -
872 arrow.offsetWidth / 2 + 'px'; 873 arrow.offsetWidth / 2 + 'px';
873 874
874 $('display-options-set-primary').hidden = 875 $('display-options-set-primary').hidden =
875 this.displays_[this.focusedIndex_].isPrimary; 876 this.displays_[this.focusedIndex_].isPrimary;
877 $('display-options-toggle-mirroring').hidden =
878 (this.displays_.length <= 1);
876 }, 879 },
877 880
878 /** 881 /**
879 * Clears the drawing area for display rectangles. 882 * Clears the drawing area for display rectangles.
880 * @private 883 * @private
881 */ 884 */
882 resetDisplaysView_: function() { 885 resetDisplaysView_: function() {
883 var displaysViewHost = $('display-options-displays-view-host'); 886 var displaysViewHost = $('display-options-displays-view-host');
884 displaysViewHost.removeChild(displaysViewHost.firstChild); 887 displaysViewHost.removeChild(displaysViewHost.firstChild);
885 this.displaysView_ = document.createElement('div'); 888 this.displaysView_ = document.createElement('div');
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1046
1044 /** 1047 /**
1045 * Called when the display arrangement has changed. 1048 * Called when the display arrangement has changed.
1046 * @param {boolean} mirroring Whether current mode is mirroring or not. 1049 * @param {boolean} mirroring Whether current mode is mirroring or not.
1047 * @param {Array} displays The list of the display information. 1050 * @param {Array} displays The list of the display information.
1048 * @param {SecondaryDisplayLayout} layout The layout strategy. 1051 * @param {SecondaryDisplayLayout} layout The layout strategy.
1049 * @param {number} offset The offset of the secondary display. 1052 * @param {number} offset The offset of the secondary display.
1050 * @private 1053 * @private
1051 */ 1054 */
1052 onDisplayChanged_: function(mirroring, displays, layout, offset) { 1055 onDisplayChanged_: function(mirroring, displays, layout, offset) {
1056 if (displays.length <= 1) {
1057 OptionsPage.showDefaultPage();
hshi1 2013/01/10 18:59:24 My bad. This is causing all the chrome://settings/
Jun Mukai 2013/01/10 19:04:37 Oops, I missed that point too :( Sorry for my bad
1058 return;
1059 }
1060
1053 this.mirroring_ = mirroring; 1061 this.mirroring_ = mirroring;
1054 this.layout_ = layout; 1062 this.layout_ = layout;
1055 this.offset_ = offset; 1063 this.offset_ = offset;
1056 this.dirty_ = false; 1064 this.dirty_ = false;
1057 1065
1058 $('display-options-toggle-mirroring').textContent = 1066 $('display-options-toggle-mirroring').textContent =
1059 loadTimeData.getString( 1067 loadTimeData.getString(
1060 this.mirroring_ ? 'stopMirroring' : 'startMirroring'); 1068 this.mirroring_ ? 'stopMirroring' : 'startMirroring');
1061 1069
1062 // Focus to the first display next to the primary one when |displays| list 1070 // Focus to the first display next to the primary one when |displays| list
(...skipping 24 matching lines...) Expand all
1087 mirroring, displays, layout, offset) { 1095 mirroring, displays, layout, offset) {
1088 DisplayOptions.getInstance().onDisplayChanged_( 1096 DisplayOptions.getInstance().onDisplayChanged_(
1089 mirroring, displays, layout, offset); 1097 mirroring, displays, layout, offset);
1090 }; 1098 };
1091 1099
1092 // Export 1100 // Export
1093 return { 1101 return {
1094 DisplayOptions: DisplayOptions 1102 DisplayOptions: DisplayOptions
1095 }; 1103 };
1096 }); 1104 });
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