OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ |
7 | 7 |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "chrome/browser/views/accessibility_event_router_views.h" | 10 #include "chrome/browser/views/accessibility_event_router_views.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public views::FocusTraversable { | 24 public views::FocusTraversable { |
25 public: | 25 public: |
26 AccessibleToolbarView(); | 26 AccessibleToolbarView(); |
27 virtual ~AccessibleToolbarView(); | 27 virtual ~AccessibleToolbarView(); |
28 | 28 |
29 // Set focus to the toolbar with complete keyboard access. | 29 // Set focus to the toolbar with complete keyboard access. |
30 // Focus will be restored to the ViewStorage with id |view_storage_id| | 30 // Focus will be restored to the ViewStorage with id |view_storage_id| |
31 // if the user escapes. If |initial_focus| is not NULL, that control will get | 31 // if the user escapes. If |initial_focus| is not NULL, that control will get |
32 // the initial focus, if it's enabled and focusable. Returns true if | 32 // the initial focus, if it's enabled and focusable. Returns true if |
33 // the toolbar was able to receive focus. | 33 // the toolbar was able to receive focus. |
34 bool SetToolbarFocus(int view_storage_id, View* initial_focus); | 34 virtual bool SetToolbarFocus(int view_storage_id, View* initial_focus); |
35 | 35 |
36 // Set focus to the toolbar with complete keyboard access, with the | 36 // Set focus to the toolbar with complete keyboard access, with the |
37 // focus initially set to the default child. Focus will be restored | 37 // focus initially set to the default child. Focus will be restored |
38 // to the ViewStorage with id |view_storage_id| if the user escapes. | 38 // to the ViewStorage with id |view_storage_id| if the user escapes. |
39 // Returns true if the toolbar was able to receive focus. | 39 // Returns true if the toolbar was able to receive focus. |
40 bool SetToolbarFocusAndFocusDefault(int view_storage_id); | 40 virtual bool SetToolbarFocusAndFocusDefault(int view_storage_id); |
41 | 41 |
42 // Overridden from views::View: | 42 // Overridden from views::View: |
43 virtual FocusTraversable* GetPaneFocusTraversable(); | 43 virtual FocusTraversable* GetPaneFocusTraversable(); |
44 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 44 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
45 virtual void SetVisible(bool flag); | 45 virtual void SetVisible(bool flag); |
46 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); | 46 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
47 | 47 |
48 // Overridden from views::FocusChangeListener: | 48 // Overridden from views::FocusChangeListener: |
49 virtual void FocusWillChange(View* focused_before, | 49 virtual void FocusWillChange(View* focused_before, |
50 View* focused_now); | 50 View* focused_now); |
51 | 51 |
52 // Overridden from views::FocusTraversable: | 52 // Overridden from views::FocusTraversable: |
53 virtual views::FocusSearch* GetFocusSearch(); | 53 virtual views::FocusSearch* GetFocusSearch(); |
54 virtual FocusTraversable* GetFocusTraversableParent(); | 54 virtual FocusTraversable* GetFocusTraversableParent(); |
55 virtual View* GetFocusTraversableParentView(); | 55 virtual View* GetFocusTraversableParentView(); |
56 | 56 |
57 protected: | 57 protected: |
58 // A subclass can override this to provide a default focusable child | 58 // A subclass can override this to provide a default focusable child |
59 // other than the first focusable child. | 59 // other than the first focusable child. |
60 virtual views::View* GetDefaultFocusableChild() { return NULL; } | 60 virtual views::View* GetDefaultFocusableChild() { return NULL; } |
61 | 61 |
| 62 // Remove toolbar focus. |
| 63 virtual void RemoveToolbarFocus(); |
| 64 |
62 // Remove toolbar focus unless a child (including indirect children) | 65 // Remove toolbar focus unless a child (including indirect children) |
63 // still has the focus. | 66 // still has the focus. |
64 void RemoveToolbarFocusIfNoChildHasFocus(); | 67 void RemoveToolbarFocusIfNoChildHasFocus(); |
65 | 68 |
66 void RemoveToolbarFocus(); | |
67 | |
68 void RestoreLastFocusedView(); | 69 void RestoreLastFocusedView(); |
69 | 70 |
70 View* GetFirstFocusableChild(); | 71 View* GetFirstFocusableChild(); |
71 View* GetLastFocusableChild(); | 72 View* GetLastFocusableChild(); |
72 | 73 |
73 bool toolbar_has_focus_; | 74 bool toolbar_has_focus_; |
74 | 75 |
75 ScopedRunnableMethodFactory<AccessibleToolbarView> method_factory_; | 76 ScopedRunnableMethodFactory<AccessibleToolbarView> method_factory_; |
76 | 77 |
77 // Save the focus manager rather than calling GetFocusManager(), | 78 // Save the focus manager rather than calling GetFocusManager(), |
(...skipping 12 matching lines...) Expand all Loading... |
90 views::Accelerator left_key_; | 91 views::Accelerator left_key_; |
91 views::Accelerator right_key_; | 92 views::Accelerator right_key_; |
92 | 93 |
93 // Last focused view that issued this traversal. | 94 // Last focused view that issued this traversal. |
94 int last_focused_view_storage_id_; | 95 int last_focused_view_storage_id_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(AccessibleToolbarView); | 97 DISALLOW_COPY_AND_ASSIGN(AccessibleToolbarView); |
97 }; | 98 }; |
98 | 99 |
99 #endif // CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ | 100 #endif // CHROME_BROWSER_VIEWS_ACCESSIBLE_TOOLBAR_VIEW_H_ |
OLD | NEW |