Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ui/views/accessible_pane_view.h

Issue 10949005: Fix toolbar keyboard accessibility on Views (alternative impl). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test on linux_chromeos Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/views/accessible_pane_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_ACCESSIBLE_PANE_VIEW_H_ 5 #ifndef UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_
6 #define UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_ 6 #define UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_
7 7
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 virtual void OnWillChangeFocus(View* focused_before, 50 virtual void OnWillChangeFocus(View* focused_before,
51 View* focused_now) OVERRIDE; 51 View* focused_now) OVERRIDE;
52 virtual void OnDidChangeFocus(View* focused_before, 52 virtual void OnDidChangeFocus(View* focused_before,
53 View* focused_now) OVERRIDE; 53 View* focused_now) OVERRIDE;
54 54
55 // Overridden from FocusTraversable: 55 // Overridden from FocusTraversable:
56 virtual FocusSearch* GetFocusSearch() OVERRIDE; 56 virtual FocusSearch* GetFocusSearch() OVERRIDE;
57 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; 57 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE;
58 virtual View* GetFocusTraversableParentView() OVERRIDE; 58 virtual View* GetFocusTraversableParentView() OVERRIDE;
59 59
60 // For testing only.
61 const ui::Accelerator& home_key() const { return home_key_; }
62 const ui::Accelerator& end_key() const { return end_key_; }
63 const ui::Accelerator& escape_key() const { return escape_key_; }
64 const ui::Accelerator& left_key() const { return left_key_; }
65 const ui::Accelerator& right_key() const { return right_key_; }
66
60 protected: 67 protected:
61 // A subclass can override this to provide a default focusable child 68 // A subclass can override this to provide a default focusable child
62 // other than the first focusable child. 69 // other than the first focusable child.
63 virtual View* GetDefaultFocusableChild(); 70 virtual View* GetDefaultFocusableChild();
64 71
72 // Returns the parent of |v|. Subclasses can override this if
73 // they need custom focus search behavior.
74 virtual View* GetParentForFocusSearch(View* v);
75
76 // Returns true if |v| is contained within the hierarchy rooted at |root|
77 // for the purpose of focus searching. Subclasses can override this if
78 // they need custom focus search behavior.
79 virtual bool ContainsForFocusSearch(View* root, const View* v);
80
65 // Remove pane focus. 81 // Remove pane focus.
66 virtual void RemovePaneFocus(); 82 virtual void RemovePaneFocus();
67 83
68 void RestoreLastFocusedView(); 84 void RestoreLastFocusedView();
69 85
70 View* GetFirstFocusableChild(); 86 View* GetFirstFocusableChild();
71 View* GetLastFocusableChild(); 87 View* GetLastFocusableChild();
72 88
89 FocusManager* focus_manager() const { return focus_manager_; }
90
91 private:
73 bool pane_has_focus_; 92 bool pane_has_focus_;
74 93
75 base::WeakPtrFactory<AccessiblePaneView> method_factory_; 94 base::WeakPtrFactory<AccessiblePaneView> method_factory_;
76 95
77 // Save the focus manager rather than calling GetFocusManager(), 96 // Save the focus manager rather than calling GetFocusManager(),
78 // so that we can remove focus listeners in the destructor. 97 // so that we can remove focus listeners in the destructor.
79 FocusManager* focus_manager_; 98 FocusManager* focus_manager_;
80 99
81 // Our custom focus search implementation that traps focus in this 100 // Our custom focus search implementation that traps focus in this
82 // pane and traverses all views that are focusable for accessibility, 101 // pane and traverses all views that are focusable for accessibility,
83 // not just those that are normally focusable. 102 // not just those that are normally focusable.
84 scoped_ptr<FocusSearch> focus_search_; 103 scoped_ptr<FocusSearch> focus_search_;
85 104
86 // Registered accelerators 105 // Registered accelerators
87 ui::Accelerator home_key_; 106 ui::Accelerator home_key_;
88 ui::Accelerator end_key_; 107 ui::Accelerator end_key_;
89 ui::Accelerator escape_key_; 108 ui::Accelerator escape_key_;
90 ui::Accelerator left_key_; 109 ui::Accelerator left_key_;
91 ui::Accelerator right_key_; 110 ui::Accelerator right_key_;
92 111
112 friend class AccessiblePaneViewFocusSearch;
113
93 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView); 114 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneView);
94 }; 115 };
95 116
96 } // namespace views 117 } // namespace views
97 118
98 #endif // UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_ 119 #endif // UI_VIEWS_ACCESSIBLE_PANE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/views/accessible_pane_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698