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_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView | 73 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView |
74 // is FocusTraversable. | 74 // is FocusTraversable. |
75 | 75 |
76 namespace ui { | 76 namespace ui { |
77 class AcceleratorTarget; | 77 class AcceleratorTarget; |
78 class AcceleratorManager; | 78 class AcceleratorManager; |
79 } | 79 } |
80 | 80 |
81 namespace views { | 81 namespace views { |
82 | 82 |
| 83 class FocusManagerDelegate; |
83 class FocusSearch; | 84 class FocusSearch; |
84 class RootView; | 85 class RootView; |
85 class View; | 86 class View; |
86 class Widget; | 87 class Widget; |
87 | 88 |
88 // The FocusTraversable interface is used by components that want to process | 89 // The FocusTraversable interface is used by components that want to process |
89 // focus traversal events (due to Tab/Shift-Tab key events). | 90 // focus traversal events (due to Tab/Shift-Tab key events). |
90 class VIEWS_EXPORT FocusTraversable { | 91 class VIEWS_EXPORT FocusTraversable { |
91 public: | 92 public: |
92 // Return a FocusSearch object that implements the algorithm to find | 93 // Return a FocusSearch object that implements the algorithm to find |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 kReasonFocusTraversal, | 130 kReasonFocusTraversal, |
130 | 131 |
131 // The focus changed due to restoring the focus. | 132 // The focus changed due to restoring the focus. |
132 kReasonFocusRestore, | 133 kReasonFocusRestore, |
133 | 134 |
134 // The focus changed due to a click or a shortcut to jump directly to | 135 // The focus changed due to a click or a shortcut to jump directly to |
135 // a particular view. | 136 // a particular view. |
136 kReasonDirectFocusChange | 137 kReasonDirectFocusChange |
137 }; | 138 }; |
138 | 139 |
139 explicit FocusManager(Widget* widget); | 140 FocusManager(Widget* widget, FocusManagerDelegate* delegate); |
140 virtual ~FocusManager(); | 141 virtual ~FocusManager(); |
141 | 142 |
142 // Processes the passed key event for accelerators and tab traversal. | 143 // Processes the passed key event for accelerators and tab traversal. |
143 // Returns false if the event has been consumed and should not be processed | 144 // Returns false if the event has been consumed and should not be processed |
144 // further. | 145 // further. |
145 bool OnKeyEvent(const KeyEvent& event); | 146 bool OnKeyEvent(const KeyEvent& event); |
146 | 147 |
147 // Returns true is the specified is part of the hierarchy of the window | 148 // Returns true is the specified is part of the hierarchy of the window |
148 // associated with this FocusManager. | 149 // associated with this FocusManager. |
149 bool ContainsView(View* view); | 150 bool ContainsView(View* view); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // at the specified view. This traverses down along the FocusTraversable | 264 // at the specified view. This traverses down along the FocusTraversable |
264 // hierarchy. | 265 // hierarchy. |
265 // Returns NULL if no focusable view were found. | 266 // Returns NULL if no focusable view were found. |
266 View* FindFocusableView(FocusTraversable* focus_traversable, | 267 View* FindFocusableView(FocusTraversable* focus_traversable, |
267 View* starting_view, | 268 View* starting_view, |
268 bool reverse); | 269 bool reverse); |
269 | 270 |
270 // The top-level Widget this FocusManager is associated with. | 271 // The top-level Widget this FocusManager is associated with. |
271 Widget* widget_; | 272 Widget* widget_; |
272 | 273 |
| 274 // The object which handles an accelerator when |accelerator_manager_| doesn't |
| 275 // handle it. |
| 276 scoped_ptr<FocusManagerDelegate> delegate_; |
| 277 |
273 // The view that currently is focused. | 278 // The view that currently is focused. |
274 View* focused_view_; | 279 View* focused_view_; |
275 | 280 |
276 // The AcceleratorManager this FocusManager is associated with. | 281 // The AcceleratorManager this FocusManager is associated with. |
277 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 282 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
278 | 283 |
279 // The storage id used in the ViewStorage to store/restore the view that last | 284 // The storage id used in the ViewStorage to store/restore the view that last |
280 // had focus. | 285 // had focus. |
281 int stored_focused_view_storage_id_; | 286 int stored_focused_view_storage_id_; |
282 | 287 |
(...skipping 10 matching lines...) Expand all Loading... |
293 | 298 |
294 // See description above getter. | 299 // See description above getter. |
295 bool is_changing_focus_; | 300 bool is_changing_focus_; |
296 | 301 |
297 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 302 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
298 }; | 303 }; |
299 | 304 |
300 } // namespace views | 305 } // namespace views |
301 | 306 |
302 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 307 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |