Chromium Code Reviews| Index: chrome/browser/resources/settings/device_page/display.js |
| diff --git a/chrome/browser/resources/settings/device_page/display.js b/chrome/browser/resources/settings/device_page/display.js |
| index eb4e56053e5874be9e1338f0afccdaae3990c010..0685b9f8dce3ac396d8b1f32dd197828bc812a49 100644 |
| --- a/chrome/browser/resources/settings/device_page/display.js |
| +++ b/chrome/browser/resources/settings/device_page/display.js |
| @@ -70,6 +70,20 @@ Polymer({ |
| /** @private {!Array<number>} Mode index values for slider. */ |
| modeValues_: Array, |
| + |
| + /** @private */ |
| + unifiedDesktopAvailable_: { |
| + type: Boolean, |
| + value: function() { |
| + return loadTimeData.getBoolean('unifiedDesktopAvailable'); |
| + } |
| + }, |
| + |
| + /** @private */ |
| + unifiedDesktopMode_: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| }, |
| /** @private {number} Selected mode index received from chrome. */ |
| @@ -245,11 +259,36 @@ Polymer({ |
| }, |
| /** |
| + * @param {boolean} unifiedDesktopAvailable |
| + * @param {boolean} unifiedDesktopMode |
| + * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays |
| + * @return {boolean} |
| + * @private |
| + */ |
| + showUnifiedDesktop_: function( |
| + unifiedDesktopAvailable, unifiedDesktopMode, displays) { |
| + return unifiedDesktopMode || |
| + (unifiedDesktopAvailable && displays.length > 1 && |
| + !this.isMirrored_(displays)); |
| + }, |
| + |
| + /** |
| + * @param {boolean} unifiedDesktopMode |
| + * @return {string} |
| + * @private |
| + */ |
| + getUnifiedDesktopText_: function(unifiedDesktopMode) { |
| + return this.i18n( |
| + unifiedDesktopMode ? 'displayMirrorOn' : 'displayMirrorOff'); |
|
malaykeshav
2017/04/05 23:02:57
Shouldn't they have a string of their own?
i18n pr
stevenjb
2017/04/06 01:56:08
Actually, we should use the more generic phase tha
|
| + }, |
| + |
| + /** |
| + * @param {boolean} unifiedDesktopMode |
| * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays |
| * @return {boolean} |
| * @private |
| */ |
| - showMirror_: function(displays) { |
| + showMirror_: function(unifiedDesktopMode, displays) { |
|
malaykeshav
2017/04/05 23:02:57
'unifiedDesktopMode' unused?
stevenjb
2017/04/06 01:56:08
Oops, it should be, thanks for catching. Done.
|
| return this.isMirrored_(displays) || displays.length == 2; |
| }, |
| @@ -423,6 +462,12 @@ Polymer({ |
| id, properties, this.setPropertiesCallback_.bind(this)); |
| }, |
| + /** @private */ |
| + onUnifiedDesktopTap_: function() { |
| + settings.display.systemDisplayApi.enableUnifiedDesktop( |
| + !this.unifiedDesktopMode_); |
| + }, |
| + |
| /** |
| * @param {!Event} e |
| * @private |
| @@ -454,6 +499,8 @@ Polymer({ |
| (this.displays && this.displays[0]); |
| this.setSelectedDisplay_(selectedDisplay); |
| + this.unifiedDesktopMode_ = primaryDisplay && primaryDisplay.isUnified; |
| + |
| this.$.displayLayout.updateDisplays(this.displays, this.layouts); |
| }, |