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 #include <memory> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "ui/base/accelerators/accelerator.h" | 14 #include "ui/base/accelerators/accelerator.h" |
15 #include "ui/base/accelerators/accelerator_manager.h" | 15 #include "ui/base/accelerators/accelerator_manager.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/views/views_export.h" | 17 #include "ui/views/views_export.h" |
18 | 18 |
19 // FocusManager handles focus traversal, stores and restores focused views, and | 19 // FocusManager handles focus traversal, stores and restores focused views, and |
20 // handles keyboard accelerators. This class is an implementation detail of | 20 // handles keyboard accelerators. This class is an implementation detail of |
21 // views::. Most callers should use methods of views:: classes rather than using | 21 // views::. Most callers should use methods of views:: classes rather than using |
22 // FocusManager directly. | 22 // FocusManager directly. |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); | 339 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); |
340 | 340 |
341 // Whether arrow key traversal is enabled. | 341 // Whether arrow key traversal is enabled. |
342 static bool arrow_key_traversal_enabled_; | 342 static bool arrow_key_traversal_enabled_; |
343 | 343 |
344 // The top-level Widget this FocusManager is associated with. | 344 // The top-level Widget this FocusManager is associated with. |
345 Widget* widget_; | 345 Widget* widget_; |
346 | 346 |
347 // The object which handles an accelerator when |accelerator_manager_| doesn't | 347 // The object which handles an accelerator when |accelerator_manager_| doesn't |
348 // handle it. | 348 // handle it. |
349 scoped_ptr<FocusManagerDelegate> delegate_; | 349 std::unique_ptr<FocusManagerDelegate> delegate_; |
350 | 350 |
351 // The view that currently is focused. | 351 // The view that currently is focused. |
352 View* focused_view_; | 352 View* focused_view_; |
353 | 353 |
354 // The AcceleratorManager this FocusManager is associated with. | 354 // The AcceleratorManager this FocusManager is associated with. |
355 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; | 355 std::unique_ptr<ui::AcceleratorManager> accelerator_manager_; |
356 | 356 |
357 // Keeps track of whether shortcut handling is currently suspended. | 357 // Keeps track of whether shortcut handling is currently suspended. |
358 bool shortcut_handling_suspended_; | 358 bool shortcut_handling_suspended_; |
359 | 359 |
360 // The storage id used in the ViewStorage to store/restore the view that last | 360 // The storage id used in the ViewStorage to store/restore the view that last |
361 // had focus. | 361 // had focus. |
362 int stored_focused_view_storage_id_; | 362 int stored_focused_view_storage_id_; |
363 | 363 |
364 // The reason why the focus most recently changed. | 364 // The reason why the focus most recently changed. |
365 FocusChangeReason focus_change_reason_; | 365 FocusChangeReason focus_change_reason_; |
366 | 366 |
367 // The list of registered FocusChange listeners. | 367 // The list of registered FocusChange listeners. |
368 base::ObserverList<FocusChangeListener, true> focus_change_listeners_; | 368 base::ObserverList<FocusChangeListener, true> focus_change_listeners_; |
369 | 369 |
370 // See description above getter. | 370 // See description above getter. |
371 bool is_changing_focus_; | 371 bool is_changing_focus_; |
372 | 372 |
373 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 373 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
374 }; | 374 }; |
375 | 375 |
376 } // namespace views | 376 } // namespace views |
377 | 377 |
378 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 378 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |