OLD | NEW |
---|---|
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 * @private | 143 * @private |
144 */ | 144 */ |
145 lastTouchLocation_: null, | 145 lastTouchLocation_: null, |
146 | 146 |
147 /** | 147 /** |
148 * Initialize the page. | 148 * Initialize the page. |
149 */ | 149 */ |
150 initializePage: function() { | 150 initializePage: function() { |
151 OptionsPage.prototype.initializePage.call(this); | 151 OptionsPage.prototype.initializePage.call(this); |
152 | 152 |
153 $('display-options-toggle-mirroring').onclick = function() { | 153 $('display-options-toggle-mirroring').onclick = (function() { |
154 this.mirroring_ = !this.mirroring_; | 154 this.mirroring_ = !this.mirroring_; |
155 chrome.send('setMirroring', [this.mirroring_]); | 155 chrome.send('setMirroring', [this.mirroring_]); |
156 }.bind(this); | 156 }).bind(this); |
157 | 157 |
158 var container = $('display-options-displays-view-host'); | 158 var container = $('display-options-displays-view-host'); |
159 container.onmousemove = this.onMouseMove_.bind(this); | 159 container.onmousemove = this.onMouseMove_.bind(this); |
160 window.addEventListener('mouseup', this.endDragging_.bind(this), true); | 160 window.addEventListener('mouseup', this.endDragging_.bind(this), true); |
161 container.ontouchmove = this.onTouchMove_.bind(this); | 161 container.ontouchmove = this.onTouchMove_.bind(this); |
162 container.ontouchend = this.endDragging_.bind(this); | 162 container.ontouchend = this.endDragging_.bind(this); |
163 | 163 |
164 $('display-options-set-primary').onclick = function() { | 164 $('display-options-set-primary').onclick = (function() { |
165 chrome.send('setPrimary', [this.displays_[this.focusedIndex_].id]); | 165 chrome.send('setPrimary', [this.displays_[this.focusedIndex_].id]); |
166 }.bind(this); | 166 }).bind(this); |
167 $('display-options-resolution-selection').onchange = function(ev) { | 167 $('display-options-resolution-selection').onchange = (function(ev) { |
168 var display = this.displays_[this.focusedIndex_]; | 168 var display = this.displays_[this.focusedIndex_]; |
169 var resolution = display.resolutions[ev.target.value]; | 169 var resolution = display.resolutions[ev.target.value]; |
170 if (resolution.scale) { | 170 if (resolution.scale) { |
171 chrome.send('setUIScale', [display.id, resolution.scale]); | 171 chrome.send('setUIScale', [display.id, resolution.scale]); |
172 } else if (resolution.deviceScaleFactor) { | |
173 chrome.send('setResolution', | |
174 [display.id, | |
175 resolution.originalWidth, | |
176 resolution.originalHeight]); | |
177 chrome.send('setDeviceScaleFactor', | |
178 [display.id, resolution.deviceScaleFactor]); | |
172 } else { | 179 } else { |
173 chrome.send('setResolution', | 180 chrome.send('setResolution', |
174 [display.id, resolution.width, resolution.height]); | 181 [display.id, resolution.width, resolution.height]); |
175 } | 182 } |
stevenjb
2014/07/28 21:44:37
I'm not sure if this is what oshima meant, but it
Jun Mukai
2014/07/28 21:51:00
That is same as my understanding.
| |
176 }.bind(this); | 183 }).bind(this); |
177 $('display-options-orientation-selection').onchange = function(ev) { | 184 $('display-options-orientation-selection').onchange = (function(ev) { |
178 chrome.send('setOrientation', [this.displays_[this.focusedIndex_].id, | 185 chrome.send('setOrientation', [this.displays_[this.focusedIndex_].id, |
179 ev.target.value]); | 186 ev.target.value]); |
180 }.bind(this); | 187 }).bind(this); |
181 $('display-options-color-profile-selection').onchange = function(ev) { | 188 $('display-options-color-profile-selection').onchange = (function(ev) { |
182 chrome.send('setColorProfile', [this.displays_[this.focusedIndex_].id, | 189 chrome.send('setColorProfile', [this.displays_[this.focusedIndex_].id, |
183 ev.target.value]); | 190 ev.target.value]); |
184 }.bind(this); | 191 }).bind(this); |
185 $('selected-display-start-calibrating-overscan').onclick = function() { | 192 $('selected-display-start-calibrating-overscan').onclick = (function() { |
186 // Passes the target display ID. Do not specify it through URL hash, | 193 // Passes the target display ID. Do not specify it through URL hash, |
187 // we do not care back/forward. | 194 // we do not care back/forward. |
188 var displayOverscan = options.DisplayOverscan.getInstance(); | 195 var displayOverscan = options.DisplayOverscan.getInstance(); |
189 displayOverscan.setDisplayId(this.displays_[this.focusedIndex_].id); | 196 displayOverscan.setDisplayId(this.displays_[this.focusedIndex_].id); |
190 OptionsPage.navigateToPage('displayOverscan'); | 197 OptionsPage.navigateToPage('displayOverscan'); |
191 chrome.send('coreOptionsUserMetricsAction', | 198 chrome.send('coreOptionsUserMetricsAction', |
192 ['Options_DisplaySetOverscan']); | 199 ['Options_DisplaySetOverscan']); |
193 }.bind(this); | 200 }).bind(this); |
194 | 201 |
195 chrome.send('getDisplayInfo'); | 202 chrome.send('getDisplayInfo'); |
196 }, | 203 }, |
197 | 204 |
198 /** @override */ | 205 /** @override */ |
199 didShowPage: function() { | 206 didShowPage: function() { |
200 var optionTitles = document.getElementsByClassName( | 207 var optionTitles = document.getElementsByClassName( |
201 'selected-display-option-title'); | 208 'selected-display-option-title'); |
202 var maxSize = 0; | 209 var maxSize = 0; |
203 for (var i = 0; i < optionTitles.length; i++) | 210 for (var i = 0; i < optionTitles.length; i++) |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 | 620 |
614 var resolution = $('display-options-resolution-selection'); | 621 var resolution = $('display-options-resolution-selection'); |
615 if (display.resolutions.length <= 1) { | 622 if (display.resolutions.length <= 1) { |
616 var option = document.createElement('option'); | 623 var option = document.createElement('option'); |
617 option.value = 'default'; | 624 option.value = 'default'; |
618 option.textContent = display.width + 'x' + display.height; | 625 option.textContent = display.width + 'x' + display.height; |
619 option.selected = true; | 626 option.selected = true; |
620 resolution.appendChild(option); | 627 resolution.appendChild(option); |
621 resolution.disabled = true; | 628 resolution.disabled = true; |
622 } else { | 629 } else { |
630 var previousOption; | |
623 for (var i = 0; i < display.resolutions.length; i++) { | 631 for (var i = 0; i < display.resolutions.length; i++) { |
624 var option = document.createElement('option'); | 632 var option = document.createElement('option'); |
625 option.value = i; | 633 option.value = i; |
626 option.textContent = display.resolutions[i].width + 'x' + | 634 option.textContent = display.resolutions[i].width + 'x' + |
627 display.resolutions[i].height; | 635 display.resolutions[i].height; |
628 if (display.resolutions[i].isBest) { | 636 if (display.resolutions[i].isBest) { |
629 option.textContent += ' ' + | 637 option.textContent += ' ' + |
630 loadTimeData.getString('annotateBest'); | 638 loadTimeData.getString('annotateBest'); |
631 } | 639 } |
640 if (display.resolutions[i].deviceScaleFactor && previousOption && | |
641 previousOption.textContent == option.textContent) { | |
642 option.textContent += | |
643 ' (' + display.resolutions[i].deviceScaleFactor + 'x)'; | |
644 } | |
632 option.selected = display.resolutions[i].selected; | 645 option.selected = display.resolutions[i].selected; |
633 resolution.appendChild(option); | 646 resolution.appendChild(option); |
647 previousOption = option; | |
634 } | 648 } |
635 resolution.disabled = (display.resolutions.length <= 1); | 649 resolution.disabled = (display.resolutions.length <= 1); |
636 } | 650 } |
637 | 651 |
638 if (display.availableColorProfiles.length <= 1) { | 652 if (display.availableColorProfiles.length <= 1) { |
639 $('selected-display-color-profile-row').hidden = true; | 653 $('selected-display-color-profile-row').hidden = true; |
640 } else { | 654 } else { |
641 $('selected-display-color-profile-row').hidden = false; | 655 $('selected-display-color-profile-row').hidden = false; |
642 var profiles = $('display-options-color-profile-selection'); | 656 var profiles = $('display-options-color-profile-selection'); |
643 profiles.innerHTML = ''; | 657 profiles.innerHTML = ''; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 mirroring, displays, layout, offset) { | 891 mirroring, displays, layout, offset) { |
878 DisplayOptions.getInstance().onDisplayChanged_( | 892 DisplayOptions.getInstance().onDisplayChanged_( |
879 mirroring, displays, layout, offset); | 893 mirroring, displays, layout, offset); |
880 }; | 894 }; |
881 | 895 |
882 // Export | 896 // Export |
883 return { | 897 return { |
884 DisplayOptions: DisplayOptions | 898 DisplayOptions: DisplayOptions |
885 }; | 899 }; |
886 }); | 900 }); |
OLD | NEW |