| 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 ShellObserver { |
| 57 public: | 57 public: |
| 58 virtual void OnMaximizeModeStarted() = 0; | 58 virtual void OnMaximizeModeStarted() {} |
| 59 virtual void OnMaximizeModeEnded() = 0; | 59 virtual void OnMaximizeModeEnded() {} |
| 60 |
| 61 virtual void OnOverviewModeStarted() {} |
| 62 virtual void OnOverviewModeEnded() {} |
| 60 | 63 |
| 61 protected: | 64 protected: |
| 62 virtual ~MaximizeModeObserver() {} | 65 virtual ~ShellObserver() {} |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 virtual ~WMHelper(); | 68 virtual ~WMHelper(); |
| 66 | 69 |
| 67 static void SetInstance(WMHelper* helper); | 70 static void SetInstance(WMHelper* helper); |
| 68 static WMHelper* GetInstance(); | 71 static WMHelper* GetInstance(); |
| 69 | 72 |
| 70 void AddActivationObserver(ActivationObserver* observer); | 73 void AddActivationObserver(ActivationObserver* observer); |
| 71 void RemoveActivationObserver(ActivationObserver* observer); | 74 void RemoveActivationObserver(ActivationObserver* observer); |
| 72 void AddFocusObserver(FocusObserver* observer); | 75 void AddFocusObserver(FocusObserver* observer); |
| 73 void RemoveFocusObserver(FocusObserver* observer); | 76 void RemoveFocusObserver(FocusObserver* observer); |
| 74 void AddCursorObserver(CursorObserver* observer); | 77 void AddCursorObserver(CursorObserver* observer); |
| 75 void RemoveCursorObserver(CursorObserver* observer); | 78 void RemoveCursorObserver(CursorObserver* observer); |
| 76 void AddMaximizeModeObserver(MaximizeModeObserver* observer); | 79 void AddShellObserver(ShellObserver* observer); |
| 77 void RemoveMaximizeModeObserver(MaximizeModeObserver* observer); | 80 void RemoveShellObserver(ShellObserver* observer); |
| 78 | 81 |
| 79 virtual const display::ManagedDisplayInfo GetDisplayInfo( | 82 virtual const display::ManagedDisplayInfo GetDisplayInfo( |
| 80 int64_t display_id) const = 0; | 83 int64_t display_id) const = 0; |
| 81 virtual aura::Window* GetContainer(int container_id) = 0; | 84 virtual aura::Window* GetContainer(int container_id) = 0; |
| 82 virtual aura::Window* GetActiveWindow() const = 0; | 85 virtual aura::Window* GetActiveWindow() const = 0; |
| 83 virtual aura::Window* GetFocusedWindow() const = 0; | 86 virtual aura::Window* GetFocusedWindow() const = 0; |
| 84 virtual ui::CursorSetType GetCursorSet() const = 0; | 87 virtual ui::CursorSetType GetCursorSet() const = 0; |
| 85 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; | 88 virtual void AddPreTargetHandler(ui::EventHandler* handler) = 0; |
| 86 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; | 89 virtual void PrependPreTargetHandler(ui::EventHandler* handler) = 0; |
| 87 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; | 90 virtual void RemovePreTargetHandler(ui::EventHandler* handler) = 0; |
| 88 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; | 91 virtual void AddPostTargetHandler(ui::EventHandler* handler) = 0; |
| 89 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; | 92 virtual void RemovePostTargetHandler(ui::EventHandler* handler) = 0; |
| 90 virtual bool IsMaximizeModeWindowManagerEnabled() const = 0; | 93 virtual bool IsMaximizeModeWindowManagerEnabled() const = 0; |
| 91 | 94 |
| 92 protected: | 95 protected: |
| 93 WMHelper(); | 96 WMHelper(); |
| 94 | 97 |
| 95 void NotifyWindowActivated(aura::Window* gained_active, | 98 void NotifyWindowActivated(aura::Window* gained_active, |
| 96 aura::Window* lost_active); | 99 aura::Window* lost_active); |
| 97 void NotifyWindowFocused(aura::Window* gained_focus, | 100 void NotifyWindowFocused(aura::Window* gained_focus, |
| 98 aura::Window* lost_focus); | 101 aura::Window* lost_focus); |
| 99 void NotifyCursorVisibilityChanged(bool is_visible); | 102 void NotifyCursorVisibilityChanged(bool is_visible); |
| 100 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); | 103 void NotifyCursorSetChanged(ui::CursorSetType cursor_set); |
| 101 void NotifyMaximizeModeStarted(); | 104 void NotifyMaximizeModeStarted(); |
| 102 void NotifyMaximizeModeEnded(); | 105 void NotifyMaximizeModeEnded(); |
| 106 void NotifyOverviewModeStarted(); |
| 107 void NotifyOverviewModeEnded(); |
| 103 | 108 |
| 104 private: | 109 private: |
| 105 base::ObserverList<ActivationObserver> activation_observers_; | 110 base::ObserverList<ActivationObserver> activation_observers_; |
| 106 base::ObserverList<FocusObserver> focus_observers_; | 111 base::ObserverList<FocusObserver> focus_observers_; |
| 107 base::ObserverList<CursorObserver> cursor_observers_; | 112 base::ObserverList<CursorObserver> cursor_observers_; |
| 108 base::ObserverList<MaximizeModeObserver> maximize_mode_observers_; | 113 base::ObserverList<ShellObserver> shell_observers_; |
| 109 | 114 |
| 110 DISALLOW_COPY_AND_ASSIGN(WMHelper); | 115 DISALLOW_COPY_AND_ASSIGN(WMHelper); |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 } // namespace exo | 118 } // namespace exo |
| 114 | 119 |
| 115 #endif // COMPONENTS_EXO_WM_HELPER_H_ | 120 #endif // COMPONENTS_EXO_WM_HELPER_H_ |
| OLD | NEW |