Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 1126933004: Allow switching between extended and unified (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
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 c12bcdadfd9156fddb84ee311195befce9fd82b6..ece3ec3d0b5647678472500eed7f44a38723ccd4 100644
--- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "ash/ash_switches.h"
#include "ash/display/display_configurator_animation.h"
#include "ash/display/display_controller.h"
#include "ash/display/display_manager.h"
@@ -201,6 +202,10 @@ void DisplayOptionsHandler::GetLocalizedValues(
localized_strings->SetString(
"selectedDisplayColorProfile", l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_COLOR_PROFILE));
+ localized_strings->SetString(
+ "enableUnifiedDesktop",
+ l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_ENABLE_UNIFIED_DESKTOP));
}
void DisplayOptionsHandler::InitializePage() {
@@ -237,6 +242,10 @@ void DisplayOptionsHandler::RegisterMessages() {
"setColorProfile",
base::Bind(&DisplayOptionsHandler::HandleSetColorProfile,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "setUnifiedDesktopEnabled",
+ base::Bind(&DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled,
+ base::Unretained(this)));
}
void DisplayOptionsHandler::OnDisplayConfigurationChanging() {
@@ -260,7 +269,9 @@ void DisplayOptionsHandler::SendAllDisplayInfo() {
void DisplayOptionsHandler::SendDisplayInfo(
const std::vector<gfx::Display>& displays) {
DisplayManager* display_manager = GetDisplayManager();
- base::FundamentalValue mirroring(display_manager->IsInMirrorMode());
+ base::StringValue mode(
+ display_manager->IsInMirrorMode() ? "mirror" :
+ (display_manager->IsInUnifiedMode() ? "unified" : "extended"));
Jun Mukai 2015/05/20 02:47:49 Just for safety, if (mode == "unified") DCHECK(ash
oshima 2015/05/20 06:40:01 This is actually guarded by ash::switch, and DCHEC
int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
base::ListValue js_displays;
@@ -314,14 +325,17 @@ void DisplayOptionsHandler::SendDisplayInfo(
web_ui()->CallJavascriptFunction(
"options.DisplayOptions.setDisplayInfo",
- mirroring, js_displays, *layout_value.get(), *offset_value.get());
+ mode, js_displays, *layout_value.get(), *offset_value.get());
}
void DisplayOptionsHandler::UpdateDisplaySettingsEnabled() {
bool enabled = GetDisplayManager()->num_connected_displays() <= 2;
+ bool show_unified_desktop = ash::switches::UnifiedDesktopEnabled();
+
web_ui()->CallJavascriptFunction(
"options.BrowserOptions.enableDisplaySettings",
- base::FundamentalValue(enabled));
+ base::FundamentalValue(enabled),
+ base::FundamentalValue(show_unified_desktop));
}
void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) {
@@ -471,5 +485,15 @@ void DisplayOptionsHandler::HandleSetColorProfile(const base::ListValue* args) {
SendAllDisplayInfo();
}
+void DisplayOptionsHandler::HandleSetUnifiedDesktopEnabled(
+ const base::ListValue* args) {
Jun Mukai 2015/05/20 02:47:49 Also DCHECK(ash::switches::UnifiedDesktopEnabled()
oshima 2015/05/20 06:40:01 Done.
+ bool enable = false;
+ if (args->GetBoolean(0, &enable)) {
+ GetDisplayManager()->SetDefaultMultiDisplayMode(
+ enable ? DisplayManager::UNIFIED : DisplayManager::EXTENDED);
+ GetDisplayManager()->ReconfigureDisplays();
+ }
+}
+
} // namespace options
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698