OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_EXO_WM_HELPER_H_ | 5 #ifndef COMPONENTS_EXO_WM_HELPER_H_ |
6 #define COMPONENTS_EXO_WM_HELPER_H_ | 6 #define COMPONENTS_EXO_WM_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "ui/base/cursor/cursor.h" | 10 #include "ui/base/cursor/cursor.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 class CursorObserver { | 47 class CursorObserver { |
48 public: | 48 public: |
49 virtual void OnCursorVisibilityChanged(bool is_visible) {} | 49 virtual void OnCursorVisibilityChanged(bool is_visible) {} |
50 virtual void OnCursorSetChanged(ui::CursorSetType cursor_set) {} | 50 virtual void OnCursorSetChanged(ui::CursorSetType cursor_set) {} |
51 | 51 |
52 protected: | 52 protected: |
53 virtual ~CursorObserver() {} | 53 virtual ~CursorObserver() {} |
54 }; | 54 }; |
55 | 55 |
56 class MaximizeModeObserver { | 56 class TabletModeObserver { |
57 public: | 57 public: |
58 virtual void OnMaximizeModeStarted() = 0; | 58 virtual void OnTabletModeStarted() = 0; |
59 virtual void OnMaximizeModeEnding() = 0; | 59 virtual void OnTabletModeEnding() = 0; |
60 virtual void OnMaximizeModeEnded() = 0; | 60 virtual void OnTabletModeEnded() = 0; |
61 | 61 |
62 protected: | 62 protected: |
63 virtual ~MaximizeModeObserver() {} | 63 virtual ~TabletModeObserver() {} |
64 }; | 64 }; |
65 | 65 |
66 class InputDeviceEventObserver { | 66 class InputDeviceEventObserver { |
67 public: | 67 public: |
68 virtual void OnKeyboardDeviceConfigurationChanged() = 0; | 68 virtual void OnKeyboardDeviceConfigurationChanged() = 0; |
69 | 69 |
70 protected: | 70 protected: |
71 virtual ~InputDeviceEventObserver() {} | 71 virtual ~InputDeviceEventObserver() {} |
72 }; | 72 }; |
73 | 73 |
74 class DisplayConfigurationObserver { | 74 class DisplayConfigurationObserver { |
75 public: | 75 public: |
76 virtual void OnDisplayConfigurationChanged() = 0; | 76 virtual void OnDisplayConfigurationChanged() = 0; |
77 | 77 |
78 protected: | 78 protected: |
79 virtual ~DisplayConfigurationObserver() {} | 79 virtual ~DisplayConfigurationObserver() {} |
80 }; | 80 }; |
81 | 81 |
82 virtual ~WMHelper(); | 82 virtual ~WMHelper(); |
83 | 83 |
84 static void SetInstance(WMHelper* helper); | 84 static void SetInstance(WMHelper* helper); |
85 static WMHelper* GetInstance(); | 85 static WMHelper* GetInstance(); |
86 | 86 |
87 void AddActivationObserver(ActivationObserver* observer); | 87 void AddActivationObserver(ActivationObserver* observer); |
88 void RemoveActivationObserver(ActivationObserver* observer); | 88 void RemoveActivationObserver(ActivationObserver* observer); |
89 void AddFocusObserver(FocusObserver* observer); | 89 void AddFocusObserver(FocusObserver* observer); |
90 void RemoveFocusObserver(FocusObserver* observer); | 90 void RemoveFocusObserver(FocusObserver* observer); |
91 void AddCursorObserver(CursorObserver* observer); | 91 void AddCursorObserver(CursorObserver* observer); |
92 void RemoveCursorObserver(CursorObserver* observer); | 92 void RemoveCursorObserver(CursorObserver* observer); |
93 void AddMaximizeModeObserver(MaximizeModeObserver* observer); | 93 void AddTabletModeObserver(TabletModeObserver* observer); |
94 void RemoveMaximizeModeObserver(MaximizeModeObserver* observer); | 94 void RemoveTabletModeObserver(TabletModeObserver* observer); |
95 void AddInputDeviceEventObserver(InputDeviceEventObserver* observer); | 95 void AddInputDeviceEventObserver(InputDeviceEventObserver* observer); |
96 void RemoveInputDeviceEventObserver(InputDeviceEventObserver* observer); | 96 void RemoveInputDeviceEventObserver(InputDeviceEventObserver* observer); |
97 void AddDisplayConfigurationObserver(DisplayConfigurationObserver* observer); | 97 void AddDisplayConfigurationObserver(DisplayConfigurationObserver* observer); |
98 void RemoveDisplayConfigurationObserver( | 98 void RemoveDisplayConfigurationObserver( |
99 DisplayConfigurationObserver* observer); | 99 DisplayConfigurationObserver* observer); |
100 | 100 |
101 virtual const display::ManagedDisplayInfo GetDisplayInfo( | 101 virtual const display::ManagedDisplayInfo GetDisplayInfo( |
102 int64_t display_id) const = 0; | 102 int64_t display_id) const = 0; |
103 virtual aura::Window* GetContainer(int container_id) = 0; | 103 virtual aura::Window* GetContainer(int container_id) = 0; |
104 virtual aura::Window* GetActiveWindow() const = 0; | 104 virtual aura::Window* GetActiveWindow() const = 0; |
105 virtual aura::Window* GetFocusedWindow() const = 0; | 105 virtual aura::Window* GetFocusedWindow() const = 0; |
106 virtual ui::CursorSetType GetCursorSet() const = 0; | 106 virtual ui::CursorSetType GetCursorSet() const = 0; |
107 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; | 107 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; |
108 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; | 108 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; |
109 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; | 109 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; |
110 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; | 110 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; |
111 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; | 111 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; |
112 virtual bool IsMaximizeModeWindowManagerEnabled() const = 0; | 112 virtual bool IsTabletModeWindowManagerEnabled() const = 0; |
113 | 113 |
114 protected: | 114 protected: |
115 WMHelper(); | 115 WMHelper(); |
116 | 116 |
117 void NotifyWindowActivated(aura::Window* gained_active, | 117 void NotifyWindowActivated(aura::Window* gained_active, |
118 aura::Window* lost_active); | 118 aura::Window* lost_active); |
119 void NotifyWindowFocused(aura::Window* gained_focus, | 119 void NotifyWindowFocused(aura::Window* gained_focus, |
120 aura::Window* lost_focus); | 120 aura::Window* lost_focus); |
121 void NotifyCursorVisibilityChanged(bool is_visible); | 121 void NotifyCursorVisibilityChanged(bool is_visible); |
122 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); | 122 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); |
123 void NotifyMaximizeModeStarted(); | 123 void NotifyTabletModeStarted(); |
124 void NotifyMaximizeModeEnding(); | 124 void NotifyTabletModeEnding(); |
125 void NotifyMaximizeModeEnded(); | 125 void NotifyTabletModeEnded(); |
126 void NotifyKeyboardDeviceConfigurationChanged(); | 126 void NotifyKeyboardDeviceConfigurationChanged(); |
127 void NotifyDisplayConfigurationChanged(); | 127 void NotifyDisplayConfigurationChanged(); |
128 | 128 |
129 private: | 129 private: |
130 base::ObserverList<ActivationObserver> activation_observers_; | 130 base::ObserverList<ActivationObserver> activation_observers_; |
131 base::ObserverList<FocusObserver> focus_observers_; | 131 base::ObserverList<FocusObserver> focus_observers_; |
132 base::ObserverList<CursorObserver> cursor_observers_; | 132 base::ObserverList<CursorObserver> cursor_observers_; |
133 base::ObserverList<MaximizeModeObserver> maximize_mode_observers_; | 133 base::ObserverList<TabletModeObserver> tablet_mode_observers_; |
134 base::ObserverList<InputDeviceEventObserver> input_device_event_observers_; | 134 base::ObserverList<InputDeviceEventObserver> input_device_event_observers_; |
135 base::ObserverList<DisplayConfigurationObserver> display_config_observers_; | 135 base::ObserverList<DisplayConfigurationObserver> display_config_observers_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(WMHelper); | 137 DISALLOW_COPY_AND_ASSIGN(WMHelper); |
138 }; | 138 }; |
139 | 139 |
140 } // namespace exo | 140 } // namespace exo |
141 | 141 |
142 #endif // COMPONENTS_EXO_WM_HELPER_H_ | 142 #endif // COMPONENTS_EXO_WM_HELPER_H_ |
OLD | NEW |