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_AURA_FOCUS_MANAGER_H_ | 5 #ifndef UI_AURA_FOCUS_MANAGER_H_ |
6 #define UI_AURA_FOCUS_MANAGER_H_ | 6 #define UI_AURA_FOCUS_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "ui/aura/aura_export.h" | 10 #include "ui/aura/aura_export.h" |
11 | 11 |
| 12 namespace ui { |
| 13 class Event; |
| 14 } |
| 15 |
12 namespace aura { | 16 namespace aura { |
13 | 17 |
14 class Event; | |
15 class FocusChangeObserver; | 18 class FocusChangeObserver; |
16 class Window; | 19 class Window; |
17 | 20 |
18 // An interface implemented by the Desktop to expose the focused window and | 21 // An interface implemented by the Desktop to expose the focused window and |
19 // allow for it to be changed. | 22 // allow for it to be changed. |
20 class AURA_EXPORT FocusManager { | 23 class AURA_EXPORT FocusManager { |
21 public: | 24 public: |
22 FocusManager(); | 25 FocusManager(); |
23 ~FocusManager(); | 26 ~FocusManager(); |
24 | 27 |
25 void AddObserver(FocusChangeObserver* observer); | 28 void AddObserver(FocusChangeObserver* observer); |
26 void RemoveObserver(FocusChangeObserver* observer); | 29 void RemoveObserver(FocusChangeObserver* observer); |
27 | 30 |
28 // Sets the currently focused window. Before the currently focused window is | 31 // Sets the currently focused window. Before the currently focused window is |
29 // changed, the previous focused window's delegate is sent a blur | 32 // changed, the previous focused window's delegate is sent a blur |
30 // notification, and after it is changed the new focused window is sent a | 33 // notification, and after it is changed the new focused window is sent a |
31 // focused notification. Nothing happens if |window| and GetFocusedWindow() | 34 // focused notification. Nothing happens if |window| and GetFocusedWindow() |
32 // match. | 35 // match. |
33 void SetFocusedWindow(Window* window, const Event* event); | 36 void SetFocusedWindow(Window* window, const ui::Event* event); |
34 | 37 |
35 // Returns the currently focused window or NULL if there is none. | 38 // Returns the currently focused window or NULL if there is none. |
36 Window* GetFocusedWindow(); | 39 Window* GetFocusedWindow(); |
37 | 40 |
38 // Returns true if |window| is the focused window. | 41 // Returns true if |window| is the focused window. |
39 bool IsFocusedWindow(const Window* window) const; | 42 bool IsFocusedWindow(const Window* window) const; |
40 | 43 |
41 protected: | 44 protected: |
42 aura::Window* focused_window_; | 45 aura::Window* focused_window_; |
43 | 46 |
44 ObserverList<FocusChangeObserver> observers_; | 47 ObserverList<FocusChangeObserver> observers_; |
45 | 48 |
46 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 49 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
47 }; | 50 }; |
48 | 51 |
49 } // namespace aura | 52 } // namespace aura |
50 | 53 |
51 #endif // UI_AURA_FOCUS_MANAGER_H_ | 54 #endif // UI_AURA_FOCUS_MANAGER_H_ |
OLD | NEW |