| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_WM_CORE_FOCUS_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_FOCUS_CONTROLLER_H_ |
| 6 #define UI_WM_CORE_FOCUS_CONTROLLER_H_ | 6 #define UI_WM_CORE_FOCUS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // . Window disposition changes (implemented here in aura::WindowObserver). | 34 // . Window disposition changes (implemented here in aura::WindowObserver). |
| 35 // (The FocusController registers itself as an observer of the active and | 35 // (The FocusController registers itself as an observer of the active and |
| 36 // focused windows). | 36 // focused windows). |
| 37 class WM_EXPORT FocusController : public aura::client::ActivationClient, | 37 class WM_EXPORT FocusController : public aura::client::ActivationClient, |
| 38 public aura::client::FocusClient, | 38 public aura::client::FocusClient, |
| 39 public ui::EventHandler, | 39 public ui::EventHandler, |
| 40 public aura::WindowObserver { | 40 public aura::WindowObserver { |
| 41 public: | 41 public: |
| 42 // |rules| cannot be NULL. | 42 // |rules| cannot be NULL. |
| 43 explicit FocusController(FocusRules* rules); | 43 explicit FocusController(FocusRules* rules); |
| 44 virtual ~FocusController(); | 44 ~FocusController() override; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Overridden from aura::client::ActivationClient: | 47 // Overridden from aura::client::ActivationClient: |
| 48 virtual void AddObserver( | 48 void AddObserver(aura::client::ActivationChangeObserver* observer) override; |
| 49 void RemoveObserver( |
| 49 aura::client::ActivationChangeObserver* observer) override; | 50 aura::client::ActivationChangeObserver* observer) override; |
| 50 virtual void RemoveObserver( | 51 void ActivateWindow(aura::Window* window) override; |
| 51 aura::client::ActivationChangeObserver* observer) override; | 52 void DeactivateWindow(aura::Window* window) override; |
| 52 virtual void ActivateWindow(aura::Window* window) override; | 53 aura::Window* GetActiveWindow() override; |
| 53 virtual void DeactivateWindow(aura::Window* window) override; | 54 aura::Window* GetActivatableWindow(aura::Window* window) override; |
| 54 virtual aura::Window* GetActiveWindow() override; | 55 aura::Window* GetToplevelWindow(aura::Window* window) override; |
| 55 virtual aura::Window* GetActivatableWindow(aura::Window* window) override; | 56 bool CanActivateWindow(aura::Window* window) const override; |
| 56 virtual aura::Window* GetToplevelWindow(aura::Window* window) override; | |
| 57 virtual bool CanActivateWindow(aura::Window* window) const override; | |
| 58 | 57 |
| 59 // Overridden from aura::client::FocusClient: | 58 // Overridden from aura::client::FocusClient: |
| 60 virtual void AddObserver( | 59 void AddObserver(aura::client::FocusChangeObserver* observer) override; |
| 61 aura::client::FocusChangeObserver* observer) override; | 60 void RemoveObserver(aura::client::FocusChangeObserver* observer) override; |
| 62 virtual void RemoveObserver( | 61 void FocusWindow(aura::Window* window) override; |
| 63 aura::client::FocusChangeObserver* observer) override; | 62 void ResetFocusWithinActiveWindow(aura::Window* window) override; |
| 64 virtual void FocusWindow(aura::Window* window) override; | 63 aura::Window* GetFocusedWindow() override; |
| 65 virtual void ResetFocusWithinActiveWindow(aura::Window* window) override; | |
| 66 virtual aura::Window* GetFocusedWindow() override; | |
| 67 | 64 |
| 68 // Overridden from ui::EventHandler: | 65 // Overridden from ui::EventHandler: |
| 69 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 66 void OnKeyEvent(ui::KeyEvent* event) override; |
| 70 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 67 void OnMouseEvent(ui::MouseEvent* event) override; |
| 71 virtual void OnScrollEvent(ui::ScrollEvent* event) override; | 68 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 72 virtual void OnTouchEvent(ui::TouchEvent* event) override; | 69 void OnTouchEvent(ui::TouchEvent* event) override; |
| 73 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 70 void OnGestureEvent(ui::GestureEvent* event) override; |
| 74 | 71 |
| 75 // Overridden from aura::WindowObserver: | 72 // Overridden from aura::WindowObserver: |
| 76 virtual void OnWindowVisibilityChanged(aura::Window* window, | 73 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
| 77 bool visible) override; | 74 void OnWindowDestroying(aura::Window* window) override; |
| 78 virtual void OnWindowDestroying(aura::Window* window) override; | 75 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; |
| 79 virtual void OnWindowHierarchyChanging( | 76 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override; |
| 80 const HierarchyChangeParams& params) override; | |
| 81 virtual void OnWindowHierarchyChanged( | |
| 82 const HierarchyChangeParams& params) override; | |
| 83 | 77 |
| 84 // Internal implementation that sets the focused window, fires events etc. | 78 // Internal implementation that sets the focused window, fires events etc. |
| 85 // This function must be called with a valid focusable window. | 79 // This function must be called with a valid focusable window. |
| 86 void SetFocusedWindow(aura::Window* window); | 80 void SetFocusedWindow(aura::Window* window); |
| 87 | 81 |
| 88 // Internal implementation that sets the active window, fires events etc. | 82 // Internal implementation that sets the active window, fires events etc. |
| 89 // This function must be called with a valid |activatable_window|. | 83 // This function must be called with a valid |activatable_window|. |
| 90 // |requested window| refers to the window that was passed in to an external | 84 // |requested window| refers to the window that was passed in to an external |
| 91 // request (e.g. FocusWindow or ActivateWindow). It may be NULL, e.g. if | 85 // request (e.g. FocusWindow or ActivateWindow). It may be NULL, e.g. if |
| 92 // SetActiveWindow was not called by an external request. |activatable_window| | 86 // SetActiveWindow was not called by an external request. |activatable_window| |
| (...skipping 24 matching lines...) Expand all Loading... |
| 117 ObserverList<aura::client::FocusChangeObserver> focus_observers_; | 111 ObserverList<aura::client::FocusChangeObserver> focus_observers_; |
| 118 | 112 |
| 119 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; | 113 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; |
| 120 | 114 |
| 121 DISALLOW_COPY_AND_ASSIGN(FocusController); | 115 DISALLOW_COPY_AND_ASSIGN(FocusController); |
| 122 }; | 116 }; |
| 123 | 117 |
| 124 } // namespace wm | 118 } // namespace wm |
| 125 | 119 |
| 126 #endif // UI_WM_CORE_FOCUS_CONTROLLER_H_ | 120 #endif // UI_WM_CORE_FOCUS_CONTROLLER_H_ |
| OLD | NEW |