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 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // Changes the text input focus to |view->GetTextInputClient()| iff |view| | 219 // Changes the text input focus to |view->GetTextInputClient()| iff |view| |
220 // is focused. Views must call this method when their internal | 220 // is focused. Views must call this method when their internal |
221 // TextInputClient instance changes. | 221 // TextInputClient instance changes. |
222 void OnTextInputClientChanged(View* view); | 222 void OnTextInputClientChanged(View* view); |
223 | 223 |
224 // Moves the text input focus into/out from |view|. | 224 // Moves the text input focus into/out from |view|. |
225 void FocusTextInputClient(View* view); | 225 void FocusTextInputClient(View* view); |
226 void BlurTextInputClient(View* view); | 226 void BlurTextInputClient(View* view); |
227 | 227 |
228 // Disable shortcut handling. | 228 // Disable shortcut handling. |
229 static void set_shortcut_handling_suspended(bool suspended) { | 229 void set_shortcut_handling_suspended(bool suspended) { |
230 shortcut_handling_suspended_ = suspended; | 230 shortcut_handling_suspended_ = suspended; |
231 } | 231 } |
232 // Returns whether shortcut handling is currently suspended. | 232 // Returns whether shortcut handling is currently suspended. |
233 bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } | 233 bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } |
234 | 234 |
235 // Register a keyboard accelerator for the specified target. If multiple | 235 // Register a keyboard accelerator for the specified target. If multiple |
236 // targets are registered for an accelerator, a target registered later has | 236 // targets are registered for an accelerator, a target registered later has |
237 // higher priority. | 237 // higher priority. |
238 // |accelerator| is the accelerator to register. | 238 // |accelerator| is the accelerator to register. |
239 // |priority| denotes the priority of the handler. | 239 // |priority| denotes the priority of the handler. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // hierarchy. | 337 // hierarchy. |
338 // Returns NULL if no focusable view were found. | 338 // Returns NULL if no focusable view were found. |
339 View* FindFocusableView(FocusTraversable* focus_traversable, | 339 View* FindFocusableView(FocusTraversable* focus_traversable, |
340 View* starting_view, | 340 View* starting_view, |
341 bool reverse); | 341 bool reverse); |
342 | 342 |
343 // Process arrow key traversal. Returns true if the event has been consumed | 343 // Process arrow key traversal. Returns true if the event has been consumed |
344 // and should not be processed further. | 344 // and should not be processed further. |
345 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); | 345 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); |
346 | 346 |
347 // Keeps track of whether shortcut handling is currently suspended. | |
348 static bool shortcut_handling_suspended_; | |
349 | |
350 // Whether arrow key traversal is enabled. | 347 // Whether arrow key traversal is enabled. |
351 static bool arrow_key_traversal_enabled_; | 348 static bool arrow_key_traversal_enabled_; |
352 | 349 |
353 // The top-level Widget this FocusManager is associated with. | 350 // The top-level Widget this FocusManager is associated with. |
354 Widget* widget_; | 351 Widget* widget_; |
355 | 352 |
356 // The object which handles an accelerator when |accelerator_manager_| doesn't | 353 // The object which handles an accelerator when |accelerator_manager_| doesn't |
357 // handle it. | 354 // handle it. |
358 scoped_ptr<FocusManagerDelegate> delegate_; | 355 scoped_ptr<FocusManagerDelegate> delegate_; |
359 | 356 |
360 // The view that currently is focused. | 357 // The view that currently is focused. |
361 View* focused_view_; | 358 View* focused_view_; |
362 | 359 |
363 // The AcceleratorManager this FocusManager is associated with. | 360 // The AcceleratorManager this FocusManager is associated with. |
364 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 361 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; |
365 | 362 |
| 363 // Keeps track of whether shortcut handling is currently suspended. |
| 364 bool shortcut_handling_suspended_; |
| 365 |
366 // The storage id used in the ViewStorage to store/restore the view that last | 366 // The storage id used in the ViewStorage to store/restore the view that last |
367 // had focus. | 367 // had focus. |
368 int stored_focused_view_storage_id_; | 368 int stored_focused_view_storage_id_; |
369 | 369 |
370 // The reason why the focus most recently changed. | 370 // The reason why the focus most recently changed. |
371 FocusChangeReason focus_change_reason_; | 371 FocusChangeReason focus_change_reason_; |
372 | 372 |
373 // The list of registered FocusChange listeners. | 373 // The list of registered FocusChange listeners. |
374 ObserverList<FocusChangeListener, true> focus_change_listeners_; | 374 ObserverList<FocusChangeListener, true> focus_change_listeners_; |
375 | 375 |
376 // See description above getter. | 376 // See description above getter. |
377 bool is_changing_focus_; | 377 bool is_changing_focus_; |
378 | 378 |
379 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 379 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
380 }; | 380 }; |
381 | 381 |
382 } // namespace views | 382 } // namespace views |
383 | 383 |
384 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 384 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |