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

Unified Diff: ash/mus/bridge/shell_port_mash.cc

Issue 2874963002: chromeos: wireup more display management for mushrome (Closed)
Patch Set: better comment Created 3 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
« no previous file with comments | « ash/mus/bridge/shell_port_mash.h ('k') | ash/system/screen_layout_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/mus/bridge/shell_port_mash.h ('k') | ash/system/screen_layout_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698