| 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" |
| 11 | 11 |
| 12 namespace aura { | 12 namespace aura { |
| 13 class Window; | 13 class Window; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace display { | 16 namespace display { |
| 17 class Display; |
| 17 class ManagedDisplayInfo; | 18 class ManagedDisplayInfo; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace ui { | 21 namespace ui { |
| 21 class EventHandler; | 22 class EventHandler; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace exo { | 25 namespace exo { |
| 25 | 26 |
| 26 // A helper class for accessing WindowManager related features. | 27 // A helper class for accessing WindowManager related features. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 aura::Window* lost_focus) = 0; | 42 aura::Window* lost_focus) = 0; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 virtual ~FocusObserver() {} | 45 virtual ~FocusObserver() {} |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 class CursorObserver { | 48 class CursorObserver { |
| 48 public: | 49 public: |
| 49 virtual void OnCursorVisibilityChanged(bool is_visible) {} | 50 virtual void OnCursorVisibilityChanged(bool is_visible) {} |
| 50 virtual void OnCursorSetChanged(ui::CursorSetType cursor_set) {} | 51 virtual void OnCursorSetChanged(ui::CursorSetType cursor_set) {} |
| 52 virtual void OnCursorDisplayChanged(const display::Display& display) {} |
| 51 | 53 |
| 52 protected: | 54 protected: |
| 53 virtual ~CursorObserver() {} | 55 virtual ~CursorObserver() {} |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 class MaximizeModeObserver { | 58 class MaximizeModeObserver { |
| 57 public: | 59 public: |
| 58 virtual void OnMaximizeModeStarted() = 0; | 60 virtual void OnMaximizeModeStarted() = 0; |
| 59 virtual void OnMaximizeModeEnding() = 0; | 61 virtual void OnMaximizeModeEnding() = 0; |
| 60 virtual void OnMaximizeModeEnded() = 0; | 62 virtual void OnMaximizeModeEnded() = 0; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 91 void AddCursorObserver(CursorObserver* observer); | 93 void AddCursorObserver(CursorObserver* observer); |
| 92 void RemoveCursorObserver(CursorObserver* observer); | 94 void RemoveCursorObserver(CursorObserver* observer); |
| 93 void AddMaximizeModeObserver(MaximizeModeObserver* observer); | 95 void AddMaximizeModeObserver(MaximizeModeObserver* observer); |
| 94 void RemoveMaximizeModeObserver(MaximizeModeObserver* observer); | 96 void RemoveMaximizeModeObserver(MaximizeModeObserver* observer); |
| 95 void AddInputDeviceEventObserver(InputDeviceEventObserver* observer); | 97 void AddInputDeviceEventObserver(InputDeviceEventObserver* observer); |
| 96 void RemoveInputDeviceEventObserver(InputDeviceEventObserver* observer); | 98 void RemoveInputDeviceEventObserver(InputDeviceEventObserver* observer); |
| 97 void AddDisplayConfigurationObserver(DisplayConfigurationObserver* observer); | 99 void AddDisplayConfigurationObserver(DisplayConfigurationObserver* observer); |
| 98 void RemoveDisplayConfigurationObserver( | 100 void RemoveDisplayConfigurationObserver( |
| 99 DisplayConfigurationObserver* observer); | 101 DisplayConfigurationObserver* observer); |
| 100 | 102 |
| 101 virtual const display::ManagedDisplayInfo GetDisplayInfo( | 103 virtual const display::ManagedDisplayInfo& GetDisplayInfo( |
| 102 int64_t display_id) const = 0; | 104 int64_t display_id) const = 0; |
| 103 virtual aura::Window* GetContainer(int container_id) = 0; | 105 virtual aura::Window* GetPrimaryDisplayContainer(int container_id) = 0; |
| 104 virtual aura::Window* GetActiveWindow() const = 0; | 106 virtual aura::Window* GetActiveWindow() const = 0; |
| 105 virtual aura::Window* GetFocusedWindow() const = 0; | 107 virtual aura::Window* GetFocusedWindow() const = 0; |
| 106 virtual ui::CursorSetType GetCursorSet() const = 0; | 108 virtual ui::CursorSetType GetCursorSet() const = 0; |
| 109 virtual const display::Display& GetCursorDisplay() const = 0; |
| 107 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; | 110 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; |
| 108 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; | 111 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; |
| 109 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; | 112 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; |
| 110 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; | 113 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; |
| 111 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; | 114 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; |
| 112 virtual bool IsMaximizeModeWindowManagerEnabled() const = 0; | 115 virtual bool IsMaximizeModeWindowManagerEnabled() const = 0; |
| 113 | 116 |
| 114 protected: | 117 protected: |
| 115 WMHelper(); | 118 WMHelper(); |
| 116 | 119 |
| 117 void NotifyWindowActivated(aura::Window* gained_active, | 120 void NotifyWindowActivated(aura::Window* gained_active, |
| 118 aura::Window* lost_active); | 121 aura::Window* lost_active); |
| 119 void NotifyWindowFocused(aura::Window* gained_focus, | 122 void NotifyWindowFocused(aura::Window* gained_focus, |
| 120 aura::Window* lost_focus); | 123 aura::Window* lost_focus); |
| 121 void NotifyCursorVisibilityChanged(bool is_visible); | 124 void NotifyCursorVisibilityChanged(bool is_visible); |
| 122 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); | 125 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); |
| 126 void NotifyCursorDisplayChanged(const display::Display& display); |
| 123 void NotifyMaximizeModeStarted(); | 127 void NotifyMaximizeModeStarted(); |
| 124 void NotifyMaximizeModeEnding(); | 128 void NotifyMaximizeModeEnding(); |
| 125 void NotifyMaximizeModeEnded(); | 129 void NotifyMaximizeModeEnded(); |
| 126 void NotifyKeyboardDeviceConfigurationChanged(); | 130 void NotifyKeyboardDeviceConfigurationChanged(); |
| 127 void NotifyDisplayConfigurationChanged(); | 131 void NotifyDisplayConfigurationChanged(); |
| 128 | 132 |
| 129 private: | 133 private: |
| 130 base::ObserverList<ActivationObserver> activation_observers_; | 134 base::ObserverList<ActivationObserver> activation_observers_; |
| 131 base::ObserverList<FocusObserver> focus_observers_; | 135 base::ObserverList<FocusObserver> focus_observers_; |
| 132 base::ObserverList<CursorObserver> cursor_observers_; | 136 base::ObserverList<CursorObserver> cursor_observers_; |
| 133 base::ObserverList<MaximizeModeObserver> maximize_mode_observers_; | 137 base::ObserverList<MaximizeModeObserver> maximize_mode_observers_; |
| 134 base::ObserverList<InputDeviceEventObserver> input_device_event_observers_; | 138 base::ObserverList<InputDeviceEventObserver> input_device_event_observers_; |
| 135 base::ObserverList<DisplayConfigurationObserver> display_config_observers_; | 139 base::ObserverList<DisplayConfigurationObserver> display_config_observers_; |
| 136 | 140 |
| 137 DISALLOW_COPY_AND_ASSIGN(WMHelper); | 141 DISALLOW_COPY_AND_ASSIGN(WMHelper); |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 } // namespace exo | 144 } // namespace exo |
| 141 | 145 |
| 142 #endif // COMPONENTS_EXO_WM_HELPER_H_ | 146 #endif // COMPONENTS_EXO_WM_HELPER_H_ |
| OLD | NEW |