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

Unified Diff: components/exo/wm_helper.cc

Issue 2250863003: exo: Run exo in mus+ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 4 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 | « components/exo/wm_helper.h ('k') | components/exo/wm_helper_ash.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wm_helper.cc
diff --git a/components/exo/wm_helper.cc b/components/exo/wm_helper.cc
index f73138a4cf3a42ca492504c0d9d0f7a5493b4f57..6e4b495ba5c8ae3a802ed9575237223eae37bd78 100644
--- a/components/exo/wm_helper.cc
+++ b/components/exo/wm_helper.cc
@@ -4,56 +4,30 @@
#include "components/exo/wm_helper.h"
-#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
-#include "ash/common/wm_shell.h"
-#include "ash/display/display_manager.h"
-#include "ash/shell.h"
-#include "base/memory/singleton.h"
-#include "ui/aura/client/focus_client.h"
-#include "ui/wm/public/activation_client.h"
+#include "base/memory/ptr_util.h"
namespace exo {
+namespace {
+WMHelper* g_instance = nullptr;
+}
////////////////////////////////////////////////////////////////////////////////
// WMHelper, public:
-WMHelper::WMHelper() {
- ash::WmShell::Get()->AddShellObserver(this);
- ash::Shell::GetInstance()->activation_client()->AddObserver(this);
- aura::client::FocusClient* focus_client =
- aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
- focus_client->AddObserver(this);
-}
+WMHelper::WMHelper() {}
-WMHelper::~WMHelper() {
- if (!ash::Shell::HasInstance())
- return;
- aura::client::FocusClient* focus_client =
- aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
- focus_client->AddObserver(this);
- focus_client->RemoveObserver(this);
- ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
- ash::WmShell::Get()->RemoveShellObserver(this);
-}
+WMHelper::~WMHelper() {}
// static
-WMHelper* WMHelper::GetInstance() {
- return base::Singleton<WMHelper>::get();
-}
-
-const ash::DisplayInfo& WMHelper::GetDisplayInfo(int64_t display_id) const {
- return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
- display_id);
+void WMHelper::SetInstance(WMHelper* helper) {
+ DCHECK_NE(!!helper, !!g_instance);
+ g_instance = helper;
}
// static
-aura::Window* WMHelper::GetContainer(int container_id) {
- return ash::Shell::GetContainer(ash::Shell::GetTargetRootWindow(),
- container_id);
-}
-
-aura::Window* WMHelper::GetActiveWindow() const {
- return ash::Shell::GetInstance()->activation_client()->GetActiveWindow();
+WMHelper* WMHelper::GetInstance() {
+ DCHECK(g_instance);
+ return g_instance;
}
void WMHelper::AddActivationObserver(ActivationObserver* observer) {
@@ -64,12 +38,6 @@ void WMHelper::RemoveActivationObserver(ActivationObserver* observer) {
activation_observers_.RemoveObserver(observer);
}
-aura::Window* WMHelper::GetFocusedWindow() const {
- aura::client::FocusClient* focus_client =
- aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
- return focus_client->GetFocusedWindow();
-}
-
void WMHelper::AddFocusObserver(FocusObserver* observer) {
focus_observers_.AddObserver(observer);
}
@@ -78,10 +46,6 @@ void WMHelper::RemoveFocusObserver(FocusObserver* observer) {
focus_observers_.RemoveObserver(observer);
}
-ui::CursorSetType WMHelper::GetCursorSet() const {
- return ash::Shell::GetInstance()->cursor_manager()->GetCursorSet();
-}
-
void WMHelper::AddCursorObserver(CursorObserver* observer) {
cursor_observers_.AddObserver(observer);
}
@@ -90,32 +54,6 @@ void WMHelper::RemoveCursorObserver(CursorObserver* observer) {
cursor_observers_.RemoveObserver(observer);
}
-void WMHelper::AddPreTargetHandler(ui::EventHandler* handler) {
- ash::Shell::GetInstance()->AddPreTargetHandler(handler);
-}
-
-void WMHelper::PrependPreTargetHandler(ui::EventHandler* handler) {
- ash::Shell::GetInstance()->PrependPreTargetHandler(handler);
-}
-
-void WMHelper::RemovePreTargetHandler(ui::EventHandler* handler) {
- ash::Shell::GetInstance()->RemovePreTargetHandler(handler);
-}
-
-void WMHelper::AddPostTargetHandler(ui::EventHandler* handler) {
- ash::Shell::GetInstance()->AddPostTargetHandler(handler);
-}
-
-void WMHelper::RemovePostTargetHandler(ui::EventHandler* handler) {
- ash::Shell::GetInstance()->RemovePostTargetHandler(handler);
-}
-
-bool WMHelper::IsMaximizeModeWindowManagerEnabled() const {
- return ash::WmShell::Get()
- ->maximize_mode_controller()
- ->IsMaximizeModeWindowManagerEnabled();
-}
-
void WMHelper::AddMaximizeModeObserver(MaximizeModeObserver* observer) {
maximize_mode_observers_.AddObserver(observer);
}
@@ -124,36 +62,34 @@ void WMHelper::RemoveMaximizeModeObserver(MaximizeModeObserver* observer) {
maximize_mode_observers_.RemoveObserver(observer);
}
-void WMHelper::OnWindowActivated(
- aura::client::ActivationChangeObserver::ActivationReason reason,
- aura::Window* gained_active,
- aura::Window* lost_active) {
+void WMHelper::NotifyWindowActivated(aura::Window* gained_active,
+ aura::Window* lost_active) {
FOR_EACH_OBSERVER(ActivationObserver, activation_observers_,
OnWindowActivated(gained_active, lost_active));
}
-void WMHelper::OnWindowFocused(aura::Window* gained_focus,
- aura::Window* lost_focus) {
+void WMHelper::NotifyWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) {
FOR_EACH_OBSERVER(FocusObserver, focus_observers_,
OnWindowFocused(gained_focus, lost_focus));
}
-void WMHelper::OnCursorVisibilityChanged(bool is_visible) {
+void WMHelper::NotifyCursorVisibilityChanged(bool is_visible) {
FOR_EACH_OBSERVER(CursorObserver, cursor_observers_,
OnCursorVisibilityChanged(is_visible));
}
-void WMHelper::OnCursorSetChanged(ui::CursorSetType cursor_set) {
+void WMHelper::NotifyCursorSetChanged(ui::CursorSetType cursor_set) {
FOR_EACH_OBSERVER(CursorObserver, cursor_observers_,
OnCursorSetChanged(cursor_set));
}
-void WMHelper::OnMaximizeModeStarted() {
+void WMHelper::NotifyMaximizeModeStarted() {
FOR_EACH_OBSERVER(MaximizeModeObserver, maximize_mode_observers_,
OnMaximizeModeStarted());
}
-void WMHelper::OnMaximizeModeEnded() {
+void WMHelper::NotifyMaximizeModeEnded() {
FOR_EACH_OBSERVER(MaximizeModeObserver, maximize_mode_observers_,
OnMaximizeModeEnded());
}
« no previous file with comments | « components/exo/wm_helper.h ('k') | components/exo/wm_helper_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698