Index: ash/mus/bridge/shell_port_mash.cc |
diff --git a/ash/mus/bridge/shell_port_mash.cc b/ash/mus/bridge/shell_port_mash.cc |
index 1ee218f48b7fc6829b43f7302532effa12efd434..58cc319459f11cdbf288b22bf4d8671f822babb9 100644 |
--- a/ash/mus/bridge/shell_port_mash.cc |
+++ b/ash/mus/bridge/shell_port_mash.cc |
@@ -169,8 +169,7 @@ void ShellPortMash::Shutdown() { |
ShellPort::Shutdown(); |
- // TODO(sky): Config::MASH should use WindowTreeHostManager too. |
- if (GetAshConfig() == Config::MUS) |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
Shell::Get()->window_tree_host_manager()->Shutdown(); |
else |
window_manager_->DeleteAllRootWindowControllers(); |
@@ -181,7 +180,7 @@ Config ShellPortMash::GetAshConfig() const { |
} |
aura::Window* ShellPortMash::GetPrimaryRootWindow() { |
- if (GetAshConfig() == Config::MUS) |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
return Shell::Get()->window_tree_host_manager()->GetPrimaryRootWindow(); |
// NOTE: This is called before the RootWindowController has been created, so |
// it can't call through to RootWindowController to get all windows. |
@@ -189,7 +188,7 @@ aura::Window* ShellPortMash::GetPrimaryRootWindow() { |
} |
aura::Window* ShellPortMash::GetRootWindowForDisplayId(int64_t display_id) { |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
return Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( |
display_id); |
} |
@@ -201,8 +200,7 @@ aura::Window* ShellPortMash::GetRootWindowForDisplayId(int64_t display_id) { |
const display::ManagedDisplayInfo& ShellPortMash::GetDisplayInfo( |
int64_t display_id) const { |
- // TODO(sky): mash should use this too http://crbug.com/718860. |
- if (GetAshConfig() == Config::MUS) |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
return Shell::Get()->display_manager()->GetDisplayInfo(display_id); |
// TODO(mash): implement http://crbug.com/622480. |
@@ -212,8 +210,7 @@ const display::ManagedDisplayInfo& ShellPortMash::GetDisplayInfo( |
} |
bool ShellPortMash::IsActiveDisplayId(int64_t display_id) const { |
- // TODO(sky): mash should use this too http://crbug.com/718860. |
- if (GetAshConfig() == Config::MUS) |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
return Shell::Get()->display_manager()->IsActiveDisplayId(display_id); |
// TODO(mash): implement http://crbug.com/622480. |
@@ -222,8 +219,7 @@ bool ShellPortMash::IsActiveDisplayId(int64_t display_id) const { |
} |
display::Display ShellPortMash::GetFirstDisplay() const { |
- // TODO(sky): mash should use this too http://crbug.com/718860. |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
return Shell::Get() |
->display_manager() |
->software_mirroring_display_list()[0]; |
@@ -235,8 +231,7 @@ display::Display ShellPortMash::GetFirstDisplay() const { |
} |
bool ShellPortMash::IsInUnifiedMode() const { |
- // TODO(sky): mash should use this too http://crbug.com/718860. |
- if (GetAshConfig() == Config::MUS) |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
return Shell::Get()->display_manager()->IsInUnifiedMode(); |
// TODO(mash): implement http://crbug.com/622480. |
@@ -245,8 +240,7 @@ bool ShellPortMash::IsInUnifiedMode() const { |
} |
bool ShellPortMash::IsInUnifiedModeIgnoreMirroring() const { |
- // TODO(sky): mash should use this too http://crbug.com/718860. |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
return Shell::Get() |
->display_manager() |
->current_default_multi_display_mode() == |
@@ -260,7 +254,7 @@ bool ShellPortMash::IsInUnifiedModeIgnoreMirroring() const { |
void ShellPortMash::SetDisplayWorkAreaInsets(WmWindow* window, |
const gfx::Insets& insets) { |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
Shell::Get() |
->window_tree_host_manager() |
->UpdateWorkAreaOfDisplayNearestWindow(window->aura_window(), insets); |
@@ -304,7 +298,7 @@ bool ShellPortMash::IsMouseEventsEnabled() { |
} |
std::vector<WmWindow*> ShellPortMash::GetAllRootWindows() { |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
aura::Window::Windows root_windows = |
Shell::Get()->window_tree_host_manager()->GetAllRootWindows(); |
std::vector<WmWindow*> wm_windows(root_windows.size()); |
@@ -381,7 +375,7 @@ ShellPortMash::CreateMaximizeModeEventHandler() { |
std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
ShellPortMash::CreateScopedDisableInternalMouseAndKeyboard() { |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
#if defined(USE_OZONE) |
return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>(); |
#else |
@@ -433,9 +427,8 @@ SessionStateDelegate* ShellPortMash::GetSessionStateDelegate() { |
} |
void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) { |
- // TODO(sky): mash should use the same code as mus/classic and |
- // WmDisplayObserver should be removed; http://crbug.com/718860. |
- if (GetAshConfig() == Config::MASH) { |
+ // TODO(sky): WmDisplayObserver should be removed; http://crbug.com/718860. |
+ if (!Shell::ShouldEnableSimplifiedDisplayManagement()) { |
NOTIMPLEMENTED(); |
return; |
} |
@@ -447,9 +440,8 @@ void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) { |
} |
void ShellPortMash::RemoveDisplayObserver(WmDisplayObserver* observer) { |
- // TODO(sky): mash should use the same code as mus/classic and |
- // WmDisplayObserver should be removed; http://crbug.com/718860. |
- if (GetAshConfig() == Config::MASH) { |
+ // TODO(sky): WmDisplayObserver should be removed; http://crbug.com/718860. |
+ if (!Shell::ShouldEnableSimplifiedDisplayManagement()) { |
NOTIMPLEMENTED(); |
return; |
} |
@@ -525,8 +517,7 @@ void ShellPortMash::CreatePointerWatcherAdapter() { |
std::unique_ptr<AshWindowTreeHost> ShellPortMash::CreateAshWindowTreeHost( |
const AshWindowTreeHostInitParams& init_params) { |
- // TODO(sky): make this work for mash too. |
- if (GetAshConfig() != Config::MUS) |
+ if (!Shell::ShouldEnableSimplifiedDisplayManagement()) |
return nullptr; |
std::unique_ptr<aura::DisplayInitParams> display_params = |
@@ -566,17 +557,16 @@ void ShellPortMash::OnCreatedRootWindowContainers( |
} |
void ShellPortMash::CreatePrimaryHost() { |
- if (GetAshConfig() == Config::MASH) |
+ if (!Shell::ShouldEnableSimplifiedDisplayManagement()) |
return; |
- DCHECK_EQ(Config::MUS, GetAshConfig()); |
Shell::Get()->window_tree_host_manager()->Start(); |
AshWindowTreeHostInitParams ash_init_params; |
Shell::Get()->window_tree_host_manager()->CreatePrimaryHost(ash_init_params); |
} |
void ShellPortMash::InitHosts(const ShellInitParams& init_params) { |
- if (GetAshConfig() == Config::MUS) { |
+ if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
Shell::Get()->window_tree_host_manager()->InitHosts(); |
} else { |
window_manager_->CreatePrimaryRootWindowController( |