| Index: chrome/browser/resources/options/chromeos/display_options.js
|
| diff --git a/chrome/browser/resources/options/chromeos/display_options.js b/chrome/browser/resources/options/chromeos/display_options.js
|
| index 052a38c5bad22238bfbb7782cf6429ef075b41f2..17e426a9253634e6d047906c2c0bedc4f4bc4d62 100644
|
| --- a/chrome/browser/resources/options/chromeos/display_options.js
|
| +++ b/chrome/browser/resources/options/chromeos/display_options.js
|
| @@ -155,10 +155,10 @@ cr.define('options', function() {
|
| initializePage: function() {
|
| OptionsPage.prototype.initializePage.call(this);
|
|
|
| - $('display-options-toggle-mirroring').onclick = (function() {
|
| + $('display-options-toggle-mirroring').onclick = function() {
|
| this.mirroring_ = !this.mirroring_;
|
| chrome.send('setMirroring', [this.mirroring_]);
|
| - }).bind(this);
|
| + }.bind(this);
|
|
|
| var container = $('display-options-displays-view-host');
|
| container.onmousemove = this.onMouseMove_.bind(this);
|
| @@ -166,17 +166,24 @@ cr.define('options', function() {
|
| container.ontouchmove = this.onTouchMove_.bind(this);
|
| container.ontouchend = this.endDragging_.bind(this);
|
|
|
| - $('display-options-set-primary').onclick = (function() {
|
| + $('display-options-set-primary').onclick = function() {
|
| chrome.send('setPrimary', [this.displays_[this.focusedIndex_].id]);
|
| - }).bind(this);
|
| -
|
| - $('selected-display-start-calibrating-overscan').onclick = (function() {
|
| + }.bind(this);
|
| + $('display-options-resolution-selection').onchange = function(ev) {
|
| + chrome.send('setUIScale', [this.displays_[this.focusedIndex_].id,
|
| + ev.target.value]);
|
| + }.bind(this);
|
| + $('display-options-orientation-selection').onchange = function(ev) {
|
| + chrome.send('setOrientation', [this.displays_[this.focusedIndex_].id,
|
| + ev.target.value]);
|
| + }.bind(this);
|
| + $('selected-display-start-calibrating-overscan').onclick = function() {
|
| // Passes the target display ID. Do not specify it through URL hash,
|
| // we do not care back/forward.
|
| var displayOverscan = options.DisplayOverscan.getInstance();
|
| displayOverscan.setDisplayId(this.displays_[this.focusedIndex_].id);
|
| OptionsPage.navigateToPage('displayOverscan');
|
| - }).bind(this);
|
| + }.bind(this);
|
|
|
| chrome.send('getDisplayInfo');
|
| },
|
| @@ -465,13 +472,15 @@ cr.define('options', function() {
|
| continue;
|
|
|
| display.div.classList.add('displays-focused');
|
| - this.dragging_ = {
|
| - display: display,
|
| - originalLocation: {
|
| - x: display.div.offsetLeft, y: display.div.offsetTop
|
| - },
|
| - eventLocation: eventLocation
|
| - };
|
| + if (this.displays_.length > 1) {
|
| + this.dragging_ = {
|
| + display: display,
|
| + originalLocation: {
|
| + x: display.div.offsetLeft, y: display.div.offsetTop
|
| + },
|
| + eventLocation: eventLocation
|
| + };
|
| + }
|
| }
|
|
|
| this.updateSelectedDisplayDescription_();
|
| @@ -523,50 +532,81 @@ cr.define('options', function() {
|
| * @private
|
| */
|
| updateSelectedDisplayDescription_: function() {
|
| + var resolution = $('display-options-resolution-selection');
|
| + resolution.textContent = '';
|
| + var orientation = $('display-options-orientation-selection');
|
| + var orientationOptions = orientation.getElementsByTagName('option');
|
| + for (var i = 0; i < orientationOptions.length; i++) {
|
| + orientationOptions.selected = false;
|
| + }
|
| +
|
| if (this.mirroring_) {
|
| $('display-configuration-arrow').hidden = true;
|
| - $('display-options-set-primary').hidden = true;
|
| - $('display-options-toggle-mirroring').hidden = false;
|
| - $('selected-display-data-container').hidden = false;
|
| + $('display-options-set-primary').disabled = true;
|
| + $('display-options-toggle-mirroring').disabled = false;
|
| + $('selected-display-start-calibrating-overscan').disabled = true;
|
| + orientation.disabled = true;
|
| var display = this.displays_[0];
|
| - $('selected-display-name').textContent = '';
|
| - $('selected-display-resolution').textContent =
|
| - display.width + 'x' + display.height;
|
| - return;
|
| - }
|
| -
|
| - if (this.focusedIndex_ == null ||
|
| + $('selected-display-name').textContent =
|
| + loadTimeData.getString('mirroringDisplay');
|
| + resolution.appendChild(document.createElement('option'));
|
| + resolution.disabled = true;
|
| + } else if (this.focusedIndex_ == null ||
|
| this.displays_[this.focusedIndex_] == null) {
|
| - $('selected-display-data-container').hidden = true;
|
| $('display-configuration-arrow').hidden = true;
|
| - $('display-options-set-primary').hidden = true;
|
| - $('display-options-toggle-mirroring').hidden = true;
|
| - return;
|
| + $('display-options-set-primary').disabled = true;
|
| + $('display-options-toggle-mirroring').disabled = true;
|
| + $('selected-display-start-calibrating-overscan').disabled = true;
|
| + orientation.disabled = true;
|
| + $('selected-display-name').textContent = '';
|
| + resolution.appendChild(document.createElement('option'));
|
| + resolution.disabled = true;
|
| + } else {
|
| + var display = this.displays_[this.focusedIndex_];
|
| +
|
| + var arrow = $('display-configuration-arrow');
|
| + arrow.hidden = false;
|
| + // Adding 1 px to the position to fit the border line and the border in
|
| + // arrow precisely.
|
| + arrow.style.top = $('display-configurations').offsetTop -
|
| + arrow.offsetHeight / 2 + 'px';
|
| + arrow.style.left = display.div.offsetLeft +
|
| + display.div.offsetWidth / 2 - arrow.offsetWidth / 2 + 'px';
|
| +
|
| + $('display-options-set-primary').disabled = display.isPrimary;
|
| + $('display-options-toggle-mirroring').disabled =
|
| + (this.displays_.length <= 1);
|
| + $('selected-display-start-calibrating-overscan').disabled =
|
| + display.isInternal;
|
| +
|
| + orientation.disabled = false;
|
| + orientationOptions[display.orientation].selected = true;
|
| +
|
| + $('selected-display-name').textContent = display.name;
|
| +
|
| + if (display.uiScales.length <= 1) {
|
| + var option = document.createElement('option');
|
| + option.value = 'default';
|
| + option.textContent = display.width + 'x' + display.height;
|
| + option.selected = true;
|
| + resolution.appendChild(option);
|
| + resolution.disabled = true;
|
| + } else {
|
| + for (var i = 0; i < display.uiScales.length; i++) {
|
| + var option = document.createElement('option');
|
| + option.value = display.uiScales[i].scale;
|
| + option.textContent =
|
| + display.uiScales[i].width + 'x' + display.uiScales[i].height;
|
| + if (display.uiScales[i].scale == 1.0) {
|
| + option.textContent += ' ' +
|
| + loadTimeData.getString('annotateBest');
|
| + }
|
| + option.selected = display.uiScales[i].selected;
|
| + resolution.appendChild(option);
|
| + }
|
| + resolution.disabled = !display.isInternal;
|
| + }
|
| }
|
| -
|
| - $('selected-display-data-container').hidden = false;
|
| - var display = this.displays_[this.focusedIndex_];
|
| - var nameElement = $('selected-display-name');
|
| - nameElement.textContent = display.name;
|
| -
|
| - var resolutionElement = $('selected-display-resolution');
|
| - resolutionElement.textContent = display.width + 'x' + display.height;
|
| -
|
| - $('start-calibrating-overscan-control').hidden = display.isInternal;
|
| -
|
| - var arrow = $('display-configuration-arrow');
|
| - arrow.hidden = false;
|
| - // Adding 1 px to the position to fit the border line and the border in
|
| - // arrow precisely.
|
| - arrow.style.top = $('display-configurations').offsetTop -
|
| - arrow.offsetHeight / 2 + 1 + 'px';
|
| - arrow.style.left = display.div.offsetLeft + display.div.offsetWidth / 2 -
|
| - arrow.offsetWidth / 2 + 'px';
|
| -
|
| - $('display-options-set-primary').hidden =
|
| - this.displays_[this.focusedIndex_].isPrimary;
|
| - $('display-options-toggle-mirroring').hidden =
|
| - (this.displays_.length <= 1 && !this.mirroring_);
|
| },
|
|
|
| /**
|
| @@ -743,10 +783,6 @@ cr.define('options', function() {
|
| break;
|
| }
|
| }
|
| - if (!hasExternal && !mirroring) {
|
| - OptionsPage.showDefaultPage();
|
| - return;
|
| - }
|
|
|
| this.mirroring_ = mirroring;
|
| this.layout_ = layout;
|
|
|