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

Side by Side Diff: components/exo/wm_helper.h

Issue 2242283002: Add an adapter layer (WMHelper) between exo and ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update 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
« no previous file with comments | « components/exo/wayland/server.cc ('k') | components/exo/wm_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_EXO_WM_HELPER_H_
6 #define COMPONENTS_EXO_WM_HELPER_H_
7
8 #include "ash/common/shell_observer.h"
9 #include "base/macros.h"
10 #include "base/observer_list.h"
11 #include "ui/aura/client/cursor_client_observer.h"
12 #include "ui/aura/client/focus_change_observer.h"
13 #include "ui/wm/public/activation_change_observer.h"
14
15 namespace ash {
16 class DisplayInfo;
17 }
18
19 namespace aura {
20 class Window;
21 }
22
23 namespace ui {
24 class EventHandler;
25 }
26
27 namespace base {
28 template <typename T>
29 struct DefaultSingletonTraits;
30 }
31
32 namespace exo {
33
34 // A helper class for accessing WindowManager related features.
35 class WMHelper : public aura::client::ActivationChangeObserver,
36 public aura::client::FocusChangeObserver,
37 public aura::client::CursorClientObserver,
38 public ash::ShellObserver {
39 public:
40 class ActivationObserver {
41 public:
42 virtual void OnWindowActivated(aura::Window* gained_active,
43 aura::Window* lost_active) = 0;
44
45 protected:
46 virtual ~ActivationObserver() {}
47 };
48
49 class FocusObserver {
50 public:
51 virtual void OnWindowFocused(aura::Window* gained_focus,
52 aura::Window* lost_focus) = 0;
53
54 protected:
55 virtual ~FocusObserver() {}
56 };
57
58 class CursorObserver {
59 public:
60 virtual void OnCursorVisibilityChanged(bool is_visible) {}
61 virtual void OnCursorSetChanged(ui::CursorSetType cursor_set) {}
62
63 protected:
64 virtual ~CursorObserver() {}
65 };
66
67 class MaximizeModeObserver {
68 public:
69 virtual void OnMaximizeModeStarted() = 0;
70 virtual void OnMaximizeModeEnded() = 0;
71
72 protected:
73 virtual ~MaximizeModeObserver() {}
74 };
75
76 static WMHelper* GetInstance();
77
78 const ash::DisplayInfo& GetDisplayInfo(int64_t display_id) const;
79 static aura::Window* GetContainer(int container_id);
80
81 aura::Window* GetActiveWindow() const;
82 void AddActivationObserver(ActivationObserver* observer);
83 void RemoveActivationObserver(ActivationObserver* observer);
84
85 aura::Window* GetFocusedWindow() const;
86 void AddFocusObserver(FocusObserver* observer);
87 void RemoveFocusObserver(FocusObserver* observer);
88
89 ui::CursorSetType GetCursorSet() const;
90 void AddCursorObserver(CursorObserver* observer);
91 void RemoveCursorObserver(CursorObserver* observer);
92
93 void AddPreTargetHandler(ui::EventHandler* handler);
94 void PrependPreTargetHandler(ui::EventHandler* handler);
95 void RemovePreTargetHandler(ui::EventHandler* handler);
96
97 void AddPostTargetHandler(ui::EventHandler* handler);
98 void RemovePostTargetHandler(ui::EventHandler* handler);
99
100 bool IsMaximizeModeWindowManagerEnabled() const;
101 void AddMaximizeModeObserver(MaximizeModeObserver* observer);
102 void RemoveMaximizeModeObserver(MaximizeModeObserver* observer);
103
104 private:
105 WMHelper();
106 ~WMHelper() override;
107
108 friend struct base::DefaultSingletonTraits<WMHelper>;
109
110 // aura::client::ActivationChangeObserver overrides:
reveman 2016/08/16 13:14:14 nit: "// Overridden from aura::client::ActivationC
Peng 2016/08/16 14:01:29 Done.
111 void OnWindowActivated(
112 aura::client::ActivationChangeObserver::ActivationReason reason,
113 aura::Window* gained_active,
114 aura::Window* lost_active) override;
115
116 // aura::client::FocusChangeObserver overrides:
reveman 2016/08/16 13:14:14 nit: // Overridden from..
Peng 2016/08/16 14:01:29 Done.
117 void OnWindowFocused(aura::Window* gained_focus,
118 aura::Window* lost_focus) override;
119
120 // aura::client::CursorClientObserver overrides:
reveman 2016/08/16 13:14:14 nit: // Overridden from..
Peng 2016/08/16 14:01:29 Done.
121 void OnCursorVisibilityChanged(bool is_visible) override;
122 void OnCursorSetChanged(ui::CursorSetType cursor_set) override;
123
124 // ash::ShellObserver overrides:
reveman 2016/08/16 13:14:14 nit: // Overridden from..
Peng 2016/08/16 14:01:29 Done.
125 void OnMaximizeModeStarted() override;
126 void OnMaximizeModeEnded() override;
127
128 base::ObserverList<ActivationObserver> activation_observers_;
129 base::ObserverList<FocusObserver> focus_observers_;
130 base::ObserverList<CursorObserver> cursor_observers_;
131 base::ObserverList<MaximizeModeObserver> maximize_mode_observers_;
132
133 DISALLOW_COPY_AND_ASSIGN(WMHelper);
134 };
135
136 } // namespace exo
137
138 #endif // COMPONENTS_EXO_WM_HELPER_H_
OLDNEW
« no previous file with comments | « components/exo/wayland/server.cc ('k') | components/exo/wm_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698