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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // active/inactive. | 181 // active/inactive. |
182 void StoreFocusedView(); | 182 void StoreFocusedView(); |
183 void RestoreFocusedView(); | 183 void RestoreFocusedView(); |
184 | 184 |
185 // Clears the stored focused view. | 185 // Clears the stored focused view. |
186 void ClearStoredFocusedView(); | 186 void ClearStoredFocusedView(); |
187 | 187 |
188 // Returns true if in the process of changing the focused view. | 188 // Returns true if in the process of changing the focused view. |
189 bool is_changing_focus() const { return is_changing_focus_; } | 189 bool is_changing_focus() const { return is_changing_focus_; } |
190 | 190 |
| 191 // Disable shortcut handling. |
| 192 static void set_shortcut_handling_suspended(bool suspended) { |
| 193 shortcut_handling_suspended_ = suspended; |
| 194 } |
| 195 // Returns whether shortcut handling is currently suspended. |
| 196 bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } |
| 197 |
191 // Register a keyboard accelerator for the specified target. If multiple | 198 // Register a keyboard accelerator for the specified target. If multiple |
192 // targets are registered for an accelerator, a target registered later has | 199 // targets are registered for an accelerator, a target registered later has |
193 // higher priority. | 200 // higher priority. |
194 // |accelerator| is the accelerator to register. | 201 // |accelerator| is the accelerator to register. |
195 // |priority| denotes the priority of the handler. | 202 // |priority| denotes the priority of the handler. |
196 // NOTE: In almost all cases, you should specify kNormalPriority for this | 203 // NOTE: In almost all cases, you should specify kNormalPriority for this |
197 // parameter. Setting it to kHighPriority prevents Chrome from sending the | 204 // parameter. Setting it to kHighPriority prevents Chrome from sending the |
198 // shortcut to the webpage if the renderer has focus, which is not desirable | 205 // shortcut to the webpage if the renderer has focus, which is not desirable |
199 // except for very isolated cases. | 206 // except for very isolated cases. |
200 // |target| is the AcceleratorTarget that handles the event once the | 207 // |target| is the AcceleratorTarget that handles the event once the |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 View* GetNextFocusableView(View* starting_view, bool reverse, bool dont_loop); | 268 View* GetNextFocusableView(View* starting_view, bool reverse, bool dont_loop); |
262 | 269 |
263 // Returns the focusable view found in the FocusTraversable specified starting | 270 // Returns the focusable view found in the FocusTraversable specified starting |
264 // at the specified view. This traverses down along the FocusTraversable | 271 // at the specified view. This traverses down along the FocusTraversable |
265 // hierarchy. | 272 // hierarchy. |
266 // Returns NULL if no focusable view were found. | 273 // Returns NULL if no focusable view were found. |
267 View* FindFocusableView(FocusTraversable* focus_traversable, | 274 View* FindFocusableView(FocusTraversable* focus_traversable, |
268 View* starting_view, | 275 View* starting_view, |
269 bool reverse); | 276 bool reverse); |
270 | 277 |
| 278 // Keeps track of whether shortcut handling is currently suspended. |
| 279 static bool shortcut_handling_suspended_; |
| 280 |
271 // The top-level Widget this FocusManager is associated with. | 281 // The top-level Widget this FocusManager is associated with. |
272 Widget* widget_; | 282 Widget* widget_; |
273 | 283 |
274 // The object which handles an accelerator when |accelerator_manager_| doesn't | 284 // The object which handles an accelerator when |accelerator_manager_| doesn't |
275 // handle it. | 285 // handle it. |
276 scoped_ptr<FocusManagerDelegate> delegate_; | 286 scoped_ptr<FocusManagerDelegate> delegate_; |
277 | 287 |
278 // The view that currently is focused. | 288 // The view that currently is focused. |
279 View* focused_view_; | 289 View* focused_view_; |
280 | 290 |
(...skipping 17 matching lines...) Expand all Loading... |
298 | 308 |
299 // See description above getter. | 309 // See description above getter. |
300 bool is_changing_focus_; | 310 bool is_changing_focus_; |
301 | 311 |
302 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 312 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
303 }; | 313 }; |
304 | 314 |
305 } // namespace views | 315 } // namespace views |
306 | 316 |
307 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 317 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |