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

Unified Diff: components/exo/wm_helper_ash.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_ash.h ('k') | components/exo/wm_helper_mus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wm_helper_ash.cc
diff --git a/components/exo/wm_helper_ash.cc b/components/exo/wm_helper_ash.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fb3bde612a42968a1a06bb5c21a55c034b20af55
--- /dev/null
+++ b/components/exo/wm_helper_ash.cc
@@ -0,0 +1,119 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/exo/wm_helper_ash.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"
+
+namespace exo {
+
+////////////////////////////////////////////////////////////////////////////////
+// WMHelperAsh, public:
+
+WMHelperAsh::WMHelperAsh() {
+ 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);
+}
+
+WMHelperAsh::~WMHelperAsh() {
+ if (!ash::Shell::HasInstance())
+ return;
+ aura::client::FocusClient* focus_client =
+ aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
+ focus_client->RemoveObserver(this);
+ ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
+ ash::WmShell::Get()->RemoveShellObserver(this);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WMHelperAsh, private:
+
+const ash::DisplayInfo WMHelperAsh::GetDisplayInfo(int64_t display_id) const {
+ return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
+ display_id);
+}
+
+aura::Window* WMHelperAsh::GetContainer(int container_id) {
+ return ash::Shell::GetContainer(ash::Shell::GetTargetRootWindow(),
+ container_id);
+}
+
+aura::Window* WMHelperAsh::GetActiveWindow() const {
+ return ash::Shell::GetInstance()->activation_client()->GetActiveWindow();
+}
+
+aura::Window* WMHelperAsh::GetFocusedWindow() const {
+ aura::client::FocusClient* focus_client =
+ aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
+ return focus_client->GetFocusedWindow();
+}
+
+ui::CursorSetType WMHelperAsh::GetCursorSet() const {
+ return ash::Shell::GetInstance()->cursor_manager()->GetCursorSet();
+}
+
+void WMHelperAsh::AddPreTargetHandler(ui::EventHandler* handler) {
+ ash::Shell::GetInstance()->AddPreTargetHandler(handler);
+}
+
+void WMHelperAsh::PrependPreTargetHandler(ui::EventHandler* handler) {
+ ash::Shell::GetInstance()->PrependPreTargetHandler(handler);
+}
+
+void WMHelperAsh::RemovePreTargetHandler(ui::EventHandler* handler) {
+ ash::Shell::GetInstance()->RemovePreTargetHandler(handler);
+}
+
+void WMHelperAsh::AddPostTargetHandler(ui::EventHandler* handler) {
+ ash::Shell::GetInstance()->AddPostTargetHandler(handler);
+}
+
+void WMHelperAsh::RemovePostTargetHandler(ui::EventHandler* handler) {
+ ash::Shell::GetInstance()->RemovePostTargetHandler(handler);
+}
+
+bool WMHelperAsh::IsMaximizeModeWindowManagerEnabled() const {
+ return ash::WmShell::Get()
+ ->maximize_mode_controller()
+ ->IsMaximizeModeWindowManagerEnabled();
+}
+
+void WMHelperAsh::OnWindowActivated(
+ aura::client::ActivationChangeObserver::ActivationReason reason,
+ aura::Window* gained_active,
+ aura::Window* lost_active) {
+ NotifyWindowActivated(gained_active, lost_active);
+}
+
+void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) {
+ NotifyWindowFocused(gained_focus, lost_focus);
+}
+
+void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) {
+ NotifyCursorVisibilityChanged(is_visible);
+}
+
+void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) {
+ NotifyCursorSetChanged(cursor_set);
+}
+
+void WMHelperAsh::OnMaximizeModeStarted() {
+ NotifyMaximizeModeStarted();
+}
+
+void WMHelperAsh::OnMaximizeModeEnded() {
+ NotifyMaximizeModeEnded();
+}
+
+} // namespace exo
« no previous file with comments | « components/exo/wm_helper_ash.h ('k') | components/exo/wm_helper_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698