diff options
author | Michael Giuffrida <michaelpg@chromium.org> | 2015-04-07 19:29:36 -0700 |
---|---|---|
committer | Michael Giuffrida <michaelpg@chromium.org> | 2015-04-08 02:30:36 +0000 |
commit | 4bdf57f3a696ff584cde1e2fd9431b42e6f43242 (patch) | |
tree | 6cec610cce4d679563e845e864f900fbf1e0315d | |
parent | 2293ce9fb9b50d323a2d171ad2d7d6fadd58c6b4 (diff) | |
download | chromium_src-4bdf57f3a696ff584cde1e2fd9431b42e6f43242.zip chromium_src-4bdf57f3a696ff584cde1e2fd9431b42e6f43242.tar.gz chromium_src-4bdf57f3a696ff584cde1e2fd9431b42e6f43242.tar.bz2 |
Disable display settings for 3+ displays (M42 merge)
Disable display settings because they do not work as expected
for 3+ displays.
BUG=467195
Review URL: https://codereview.chromium.org/1055473005
Cr-Commit-Position: refs/heads/master@{#323706}
(cherry picked from commit 516b0ba31533a5d72c717480f5bfdb5aa476a98f)
R=dbeam@chromium.org, oshima@chromium.org
Review URL: https://codereview.chromium.org/1063833002
Cr-Commit-Position: refs/branch-heads/2311@{#458}
Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474}
5 files changed, 49 insertions, 7 deletions
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index aeb2c34..9e97c6e 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -1696,12 +1696,14 @@ cr.define('options', function() { }, /** - * Enables or disables the ChromeOS display settings button. + * Enables or disables the Chrome OS display settings button and overlay. * @private */ - enableDisplayButton_: function(enabled) { - if (cr.isChromeOS) + enableDisplaySettings_: function(enabled) { + if (cr.isChromeOS) { $('display-options').disabled = !enabled; + DisplayOptions.getInstance().setEnabled(enabled); + } }, /** @@ -2168,7 +2170,7 @@ cr.define('options', function() { 'addBluetoothDevice', 'deleteCurrentProfile', 'enableCertificateButton', - 'enableDisplayButton', + 'enableDisplaySettings', 'enableFactoryResetSection', 'getCurrentProfile', 'getStartStopSyncButton', diff --git a/chrome/browser/resources/options/chromeos/display_options.js b/chrome/browser/resources/options/chromeos/display_options.js index 64bebd1..296a77a 100644 --- a/chrome/browser/resources/options/chromeos/display_options.js +++ b/chrome/browser/resources/options/chromeos/display_options.js @@ -170,6 +170,12 @@ cr.define('options', function() { */ lastTouchLocation_: null, + /** + * Whether the display settings can be shown. + * @private + */ + enabled_: true, + /** @override */ initializePage: function() { Page.prototype.initializePage.call(this); @@ -224,6 +230,24 @@ cr.define('options', function() { chrome.send('getDisplayInfo'); }, + /** @override */ + canShowPage: function() { + return this.enabled_; + }, + + /** + * Enables or disables the page. When disabled, the page will not be able to + * open, and will close if currently opened. + * @param {boolean} enabled Whether the page should be enabled. + */ + setEnabled: function(enabled) { + if (this.enabled_ == enabled) + return; + this.enabled_ = enabled; + if (!enabled && this.visible) + PageManager.closeOverlay(); + }, + /** * Mouse move handler for dragging display rectangle. * @param {Event} e The mouse move event. diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 001bb6d..6703e3c 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc @@ -11,6 +11,7 @@ #include "ash/ash_switches.h" #include "ash/desktop_background/desktop_background_controller.h" +#include "ash/display/display_manager.h" #include "ash/metrics/user_metrics_recorder.h" #include "ash/session/session_state_delegate.h" #include "ash/session/session_state_observer.h" @@ -469,6 +470,12 @@ void SystemTrayDelegateChromeOS::ShowBluetoothSettings() { } void SystemTrayDelegateChromeOS::ShowDisplaySettings() { + // TODO(michaelpg): Allow display settings to be shown when they are updated + // to work for 3+ displays. See issue 467195. + if (ash::Shell::GetInstance()->display_manager()->num_connected_displays() > + 2) { + return; + } content::RecordAction(base::UserMetricsAction("ShowDisplayOptions")); ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName); } diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc index 0c29fcd6..2ac0311 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc @@ -204,9 +204,7 @@ void DisplayOptionsHandler::GetLocalizedValues( void DisplayOptionsHandler::InitializePage() { DCHECK(web_ui()); - web_ui()->CallJavascriptFunction( - "options.BrowserOptions.enableDisplayButton", - base::FundamentalValue(true)); + UpdateDisplaySettingsEnabled(); } void DisplayOptionsHandler::RegisterMessages() { @@ -244,6 +242,7 @@ void DisplayOptionsHandler::OnDisplayConfigurationChanging() { } void DisplayOptionsHandler::OnDisplayConfigurationChanged() { + UpdateDisplaySettingsEnabled(); SendAllDisplayInfo(); } @@ -317,6 +316,13 @@ void DisplayOptionsHandler::SendDisplayInfo( mirroring, js_displays, *layout_value.get(), *offset_value.get()); } +void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() { + bool enabled = GetDisplayManager()->num_connected_displays() <= 2; + web_ui()->CallJavascriptFunction( + "options.BrowserOptions.enableDisplaySettings", + base::FundamentalValue(enabled)); +} + void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) { ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring); // Not necessary to start fade-in animation. DisplayConfigurator will do that. diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.h b/chrome/browser/ui/webui/options/chromeos/display_options_handler.h index 1c35c48..82d4883 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.h @@ -43,6 +43,9 @@ class DisplayOptionsHandler : public ::options::OptionsPageUIHandler, // Sends the specified display information to the web_ui of options page. void SendDisplayInfo(const std::vector<gfx::Display>& displays); + // Enables or disables the display settings UI. + void UpdateDisplaySettingsEnabled(); + // Called when the fade-out animation for mirroring status change is finished. void OnFadeOutForMirroringFinished(bool is_mirroring); |