OLD | NEW |
---|---|
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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "ui/views/focus/focus_manager.h" | 6 #include "ui/views/focus/focus_manager.h" |
7 #include "ui/views/focus/focus_search.h" | 7 #include "ui/views/focus/focus_search.h" |
8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 // Nothing found. | 91 // Nothing found. |
92 return NULL; | 92 return NULL; |
93 } | 93 } |
94 | 94 |
95 bool FocusSearch::IsViewFocusableCandidate(View* v, int skip_group_id) { | 95 bool FocusSearch::IsViewFocusableCandidate(View* v, int skip_group_id) { |
96 return IsFocusable(v) && | 96 return IsFocusable(v) && |
97 (v->IsGroupFocusTraversable() || skip_group_id == -1 || | 97 (v->IsGroupFocusTraversable() || skip_group_id == -1 || |
98 v->GetGroup() != skip_group_id); | 98 v->GetGroup() != skip_group_id); |
99 } | 99 } |
100 | 100 |
101 // On Mac, we also need to read system preferences for "Full Keyboard Access" to | |
tapted
2016/02/12 02:56:45
Can we instead expose the |accessibility_mode_| da
karandeepb
2016/02/22 07:15:37
Done. Instead of setting the accessibility mode on
| |
102 // decide whether accessibility mode should be enabled or not. | |
103 #if !defined(OS_MACOSX) | |
101 bool FocusSearch::IsFocusable(View* v) { | 104 bool FocusSearch::IsFocusable(View* v) { |
102 if (accessibility_mode_) | 105 if (accessibility_mode_) |
103 return v && v->IsAccessibilityFocusable(); | 106 return v && v->IsAccessibilityFocusable(); |
104 return v && v->IsFocusable(); | 107 return v && v->IsFocusable(); |
105 } | 108 } |
109 #endif | |
106 | 110 |
107 View* FocusSearch::FindSelectedViewForGroup(View* view) { | 111 View* FocusSearch::FindSelectedViewForGroup(View* view) { |
108 if (view->IsGroupFocusTraversable() || | 112 if (view->IsGroupFocusTraversable() || |
109 view->GetGroup() == -1) // No group for that view. | 113 view->GetGroup() == -1) // No group for that view. |
110 return view; | 114 return view; |
111 | 115 |
112 View* selected_view = view->GetSelectedViewForGroup(view->GetGroup()); | 116 View* selected_view = view->GetSelectedViewForGroup(view->GetGroup()); |
113 if (selected_view) | 117 if (selected_view) |
114 return selected_view; | 118 return selected_view; |
115 | 119 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 skip_group_id, | 270 skip_group_id, |
267 focus_traversable, | 271 focus_traversable, |
268 focus_traversable_view); | 272 focus_traversable_view); |
269 } | 273 } |
270 | 274 |
271 // We found nothing. | 275 // We found nothing. |
272 return NULL; | 276 return NULL; |
273 } | 277 } |
274 | 278 |
275 } // namespace views | 279 } // namespace views |
OLD | NEW |