| 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 5abe4f69cf7e6bb9aa7081a82f6ec0f496708ec7..da1cd5187ca2e7a5a530b1434c3e237964c364c8 100644
|
| --- a/ash/mus/bridge/shell_port_mash.cc
|
| +++ b/ash/mus/bridge/shell_port_mash.cc
|
| @@ -49,6 +49,7 @@
|
| #include "ash/wm/window_resizer.h"
|
| #include "ash/wm/window_util.h"
|
| #include "ash/wm/workspace/workspace_event_handler_aura.h"
|
| +#include "ash/wm_display_observer.h"
|
| #include "ash/wm_window.h"
|
| #include "base/command_line.h"
|
| #include "base/memory/ptr_util.h"
|
| @@ -159,6 +160,9 @@ aura::WindowTreeClient* ShellPortMash::window_tree_client() {
|
| }
|
|
|
| void ShellPortMash::Shutdown() {
|
| + if (added_display_observer_)
|
| + Shell::Get()->window_tree_host_manager()->RemoveObserver(this);
|
| +
|
| if (mus_state_)
|
| mus_state_->pointer_watcher_adapter.reset();
|
|
|
| @@ -200,6 +204,10 @@ WmWindow* 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)
|
| + return Shell::Get()->display_manager()->GetDisplayInfo(display_id);
|
| +
|
| // TODO(mash): implement http://crbug.com/622480.
|
| NOTIMPLEMENTED();
|
| static display::ManagedDisplayInfo fake_info;
|
| @@ -207,24 +215,47 @@ 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)
|
| + return Shell::Get()->display_manager()->IsActiveDisplayId(display_id);
|
| +
|
| // TODO(mash): implement http://crbug.com/622480.
|
| NOTIMPLEMENTED();
|
| return true;
|
| }
|
|
|
| display::Display ShellPortMash::GetFirstDisplay() const {
|
| + // TODO(sky): mash should use this too http://crbug.com/718860.
|
| + if (GetAshConfig() == Config::MUS) {
|
| + return Shell::Get()
|
| + ->display_manager()
|
| + ->software_mirroring_display_list()[0];
|
| + }
|
| +
|
| // TODO(mash): implement http://crbug.com/622480.
|
| NOTIMPLEMENTED();
|
| return display::Screen::GetScreen()->GetPrimaryDisplay();
|
| }
|
|
|
| bool ShellPortMash::IsInUnifiedMode() const {
|
| + // TODO(sky): mash should use this too http://crbug.com/718860.
|
| + if (GetAshConfig() == Config::MUS)
|
| + return Shell::Get()->display_manager()->IsInUnifiedMode();
|
| +
|
| // TODO(mash): implement http://crbug.com/622480.
|
| NOTIMPLEMENTED();
|
| return false;
|
| }
|
|
|
| bool ShellPortMash::IsInUnifiedModeIgnoreMirroring() const {
|
| + // TODO(sky): mash should use this too http://crbug.com/718860.
|
| + if (GetAshConfig() == Config::MUS) {
|
| + return Shell::Get()
|
| + ->display_manager()
|
| + ->current_default_multi_display_mode() ==
|
| + display::DisplayManager::UNIFIED;
|
| + }
|
| +
|
| // TODO(mash): implement http://crbug.com/622480.
|
| NOTIMPLEMENTED();
|
| return false;
|
| @@ -387,13 +418,27 @@ SessionStateDelegate* ShellPortMash::GetSessionStateDelegate() {
|
| }
|
|
|
| void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) {
|
| - // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
|
| - NOTIMPLEMENTED();
|
| + // TODO(sky): mash should use the same code as mus/classic and
|
| + // WmDisplayObserver should be removed; http://crbug.com/718860.
|
| + if (GetAshConfig() == Config::MASH) {
|
| + NOTIMPLEMENTED();
|
| + return;
|
| + }
|
| + if (!added_display_observer_) {
|
| + added_display_observer_ = true;
|
| + Shell::Get()->window_tree_host_manager()->AddObserver(this);
|
| + }
|
| + display_observers_.AddObserver(observer);
|
| }
|
|
|
| void ShellPortMash::RemoveDisplayObserver(WmDisplayObserver* observer) {
|
| - // TODO: need WmDisplayObserver support for mus. http://crbug.com/705831.
|
| - NOTIMPLEMENTED();
|
| + // TODO(sky): mash should use the same code as mus/classic and
|
| + // WmDisplayObserver should be removed; http://crbug.com/718860.
|
| + if (GetAshConfig() == Config::MASH) {
|
| + NOTIMPLEMENTED();
|
| + return;
|
| + }
|
| + display_observers_.RemoveObserver(observer);
|
| }
|
|
|
| void ShellPortMash::AddPointerWatcher(views::PointerWatcher* watcher,
|
| @@ -570,5 +615,15 @@ ShellPortMash::CreateAcceleratorController() {
|
| mash_state_->accelerator_controller_registrar.get());
|
| }
|
|
|
| +void ShellPortMash::OnDisplayConfigurationChanging() {
|
| + for (auto& observer : display_observers_)
|
| + observer.OnDisplayConfigurationChanging();
|
| +}
|
| +
|
| +void ShellPortMash::OnDisplayConfigurationChanged() {
|
| + for (auto& observer : display_observers_)
|
| + observer.OnDisplayConfigurationChanged();
|
| +}
|
| +
|
| } // namespace mus
|
| } // namespace ash
|
|
|