| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 var container = $('display-options-displays-view-host'); | 163 var container = $('display-options-displays-view-host'); |
| 164 container.onmousemove = this.onMouseMove_.bind(this); | 164 container.onmousemove = this.onMouseMove_.bind(this); |
| 165 window.addEventListener('mouseup', this.endDragging_.bind(this), true); | 165 window.addEventListener('mouseup', this.endDragging_.bind(this), true); |
| 166 container.ontouchmove = this.onTouchMove_.bind(this); | 166 container.ontouchmove = this.onTouchMove_.bind(this); |
| 167 container.ontouchend = this.endDragging_.bind(this); | 167 container.ontouchend = this.endDragging_.bind(this); |
| 168 | 168 |
| 169 $('display-options-set-primary').onclick = function() { | 169 $('display-options-set-primary').onclick = function() { |
| 170 chrome.send('setPrimary', [this.displays_[this.focusedIndex_].id]); | 170 chrome.send('setPrimary', [this.displays_[this.focusedIndex_].id]); |
| 171 }.bind(this); | 171 }.bind(this); |
| 172 $('display-options-resolution-selection').onchange = function(ev) { | 172 $('display-options-resolution-selection').onchange = function(ev) { |
| 173 chrome.send('setUIScale', [this.displays_[this.focusedIndex_].id, | 173 var display = this.displays_[this.focusedIndex_]; |
| 174 ev.target.value]); | 174 var resolution = display.resolutions[ev.target.value]; |
| 175 if (resolution.scale) { |
| 176 chrome.send('setUIScale', [display.id, resolution.scale]); |
| 177 } else { |
| 178 chrome.send('setResolution', |
| 179 [display.id, resolution.width, resolution.height]); |
| 180 } |
| 175 }.bind(this); | 181 }.bind(this); |
| 176 $('display-options-orientation-selection').onchange = function(ev) { | 182 $('display-options-orientation-selection').onchange = function(ev) { |
| 177 chrome.send('setOrientation', [this.displays_[this.focusedIndex_].id, | 183 chrome.send('setOrientation', [this.displays_[this.focusedIndex_].id, |
| 178 ev.target.value]); | 184 ev.target.value]); |
| 179 }.bind(this); | 185 }.bind(this); |
| 180 $('selected-display-start-calibrating-overscan').onclick = function() { | 186 $('selected-display-start-calibrating-overscan').onclick = function() { |
| 181 // Passes the target display ID. Do not specify it through URL hash, | 187 // Passes the target display ID. Do not specify it through URL hash, |
| 182 // we do not care back/forward. | 188 // we do not care back/forward. |
| 183 var displayOverscan = options.DisplayOverscan.getInstance(); | 189 var displayOverscan = options.DisplayOverscan.getInstance(); |
| 184 displayOverscan.setDisplayId(this.displays_[this.focusedIndex_].id); | 190 displayOverscan.setDisplayId(this.displays_[this.focusedIndex_].id); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 display.isInternal; | 605 display.isInternal; |
| 600 | 606 |
| 601 var orientation = $('display-options-orientation-selection'); | 607 var orientation = $('display-options-orientation-selection'); |
| 602 orientation.disabled = false; | 608 orientation.disabled = false; |
| 603 var orientationOptions = orientation.getElementsByTagName('option'); | 609 var orientationOptions = orientation.getElementsByTagName('option'); |
| 604 orientationOptions[display.orientation].selected = true; | 610 orientationOptions[display.orientation].selected = true; |
| 605 | 611 |
| 606 $('selected-display-name').textContent = display.name; | 612 $('selected-display-name').textContent = display.name; |
| 607 | 613 |
| 608 var resolution = $('display-options-resolution-selection'); | 614 var resolution = $('display-options-resolution-selection'); |
| 609 if (display.uiScales.length <= 1) { | 615 if (display.resolutions.length <= 1) { |
| 610 var option = document.createElement('option'); | 616 var option = document.createElement('option'); |
| 611 option.value = 'default'; | 617 option.value = 'default'; |
| 612 option.textContent = display.width + 'x' + display.height; | 618 option.textContent = display.width + 'x' + display.height; |
| 613 option.selected = true; | 619 option.selected = true; |
| 614 resolution.appendChild(option); | 620 resolution.appendChild(option); |
| 615 resolution.disabled = true; | 621 resolution.disabled = true; |
| 616 } else { | 622 } else { |
| 617 for (var i = 0; i < display.uiScales.length; i++) { | 623 for (var i = 0; i < display.resolutions.length; i++) { |
| 618 var option = document.createElement('option'); | 624 var option = document.createElement('option'); |
| 619 option.value = display.uiScales[i].scale; | 625 option.value = i; |
| 620 option.textContent = | 626 option.textContent = display.resolutions[i].width + 'x' + |
| 621 display.uiScales[i].width + 'x' + display.uiScales[i].height; | 627 display.resolutions[i].height; |
| 622 if (display.uiScales[i].scale == 1.0) { | 628 if (display.resolutions[i].isBest) { |
| 623 option.textContent += ' ' + | 629 option.textContent += ' ' + |
| 624 loadTimeData.getString('annotateBest'); | 630 loadTimeData.getString('annotateBest'); |
| 625 } | 631 } |
| 626 option.selected = display.uiScales[i].selected; | 632 option.selected = display.resolutions[i].selected; |
| 627 resolution.appendChild(option); | 633 resolution.appendChild(option); |
| 628 } | 634 } |
| 629 resolution.disabled = !display.isInternal; | 635 resolution.disabled = (display.resolutions.length <= 1); |
| 630 } | 636 } |
| 631 }, | 637 }, |
| 632 | 638 |
| 633 /** | 639 /** |
| 634 * Updates the description of the selected display section. | 640 * Updates the description of the selected display section. |
| 635 * @private | 641 * @private |
| 636 */ | 642 */ |
| 637 updateSelectedDisplayDescription_: function() { | 643 updateSelectedDisplayDescription_: function() { |
| 638 var resolution = $('display-options-resolution-selection'); | 644 var resolution = $('display-options-resolution-selection'); |
| 639 resolution.textContent = ''; | 645 resolution.textContent = ''; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 mirroring, displays, layout, offset) { | 868 mirroring, displays, layout, offset) { |
| 863 DisplayOptions.getInstance().onDisplayChanged_( | 869 DisplayOptions.getInstance().onDisplayChanged_( |
| 864 mirroring, displays, layout, offset); | 870 mirroring, displays, layout, offset); |
| 865 }; | 871 }; |
| 866 | 872 |
| 867 // Export | 873 // Export |
| 868 return { | 874 return { |
| 869 DisplayOptions: DisplayOptions | 875 DisplayOptions: DisplayOptions |
| 870 }; | 876 }; |
| 871 }); | 877 }); |
| OLD | NEW |