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

Side by Side 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 review issues 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/exo/wm_helper_ash.h"
6
7 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
8 #include "ash/common/wm_shell.h"
9 #include "ash/display/display_manager.h"
10 #include "ash/shell.h"
11 #include "base/memory/singleton.h"
12 #include "ui/aura/client/focus_client.h"
13 #include "ui/wm/public/activation_client.h"
14
15 namespace exo {
16
17 ////////////////////////////////////////////////////////////////////////////////
18 // WMHelperAsh, public:
19
20 WMHelperAsh::WMHelperAsh() {
21 ash::WmShell::Get()->AddShellObserver(this);
22 ash::Shell::GetInstance()->activation_client()->AddObserver(this);
23 aura::client::FocusClient* focus_client =
24 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
25 focus_client->AddObserver(this);
26 }
27
28 WMHelperAsh::~WMHelperAsh() {
29 if (!ash::Shell::HasInstance())
30 return;
31 aura::client::FocusClient* focus_client =
32 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
33 focus_client->AddObserver(this);
34 focus_client->RemoveObserver(this);
35 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
36 ash::WmShell::Get()->RemoveShellObserver(this);
37 }
38
39 ////////////////////////////////////////////////////////////////////////////////
40 // WMHelperAsh, private:
41
42 const ash::DisplayInfo WMHelperAsh::GetDisplayInfo(int64_t display_id) const {
43 return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
44 display_id);
45 }
46
47 aura::Window* WMHelperAsh::GetContainer(int container_id) {
48 return ash::Shell::GetContainer(ash::Shell::GetTargetRootWindow(),
49 container_id);
50 }
51
52 aura::Window* WMHelperAsh::GetActiveWindow() const {
53 return ash::Shell::GetInstance()->activation_client()->GetActiveWindow();
54 }
55
56 aura::Window* WMHelperAsh::GetFocusedWindow() const {
57 aura::client::FocusClient* focus_client =
58 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
59 return focus_client->GetFocusedWindow();
60 }
61
62 ui::CursorSetType WMHelperAsh::GetCursorSet() const {
63 return ash::Shell::GetInstance()->cursor_manager()->GetCursorSet();
64 }
65
66 void WMHelperAsh::AddPreTargetHandler(ui::EventHandler* handler) {
67 ash::Shell::GetInstance()->AddPreTargetHandler(handler);
68 }
69
70 void WMHelperAsh::PrependPreTargetHandler(ui::EventHandler* handler) {
71 ash::Shell::GetInstance()->PrependPreTargetHandler(handler);
72 }
73
74 void WMHelperAsh::RemovePreTargetHandler(ui::EventHandler* handler) {
75 ash::Shell::GetInstance()->RemovePreTargetHandler(handler);
76 }
77
78 void WMHelperAsh::AddPostTargetHandler(ui::EventHandler* handler) {
79 ash::Shell::GetInstance()->AddPostTargetHandler(handler);
80 }
81
82 void WMHelperAsh::RemovePostTargetHandler(ui::EventHandler* handler) {
83 ash::Shell::GetInstance()->RemovePostTargetHandler(handler);
84 }
85
86 bool WMHelperAsh::IsMaximizeModeWindowManagerEnabled() const {
87 return ash::WmShell::Get()
88 ->maximize_mode_controller()
89 ->IsMaximizeModeWindowManagerEnabled();
90 }
91
92 void WMHelperAsh::OnWindowActivated(
93 aura::client::ActivationChangeObserver::ActivationReason reason,
94 aura::Window* gained_active,
95 aura::Window* lost_active) {
96 NotifyWindowActivated(gained_active, lost_active);
97 }
98
99 void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus,
100 aura::Window* lost_focus) {
101 NotifyWindowFocused(gained_focus, lost_focus);
102 }
103
104 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) {
105 NotifyCursorVisibilityChanged(is_visible);
106 }
107
108 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) {
109 NotifyCursorSetChanged(cursor_set);
110 }
111
112 void WMHelperAsh::OnMaximizeModeStarted() {
113 NotifyMaximizeModeStarted();
114 }
115
116 void WMHelperAsh::OnMaximizeModeEnded() {
117 NotifyMaximizeModeEnded();
118 }
119
120 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698