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

Side by Side Diff: ui/views/focus/focus_search.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FocusManagerTest.StoreFocusedView Created 4 years, 10 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
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 #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 #include "ui/views/widget/widget.h"
9 10
10 namespace views { 11 namespace views {
11 12
12 FocusSearch::FocusSearch(View* root, bool cycle, bool accessibility_mode) 13 FocusSearch::FocusSearch(View* root, bool cycle, bool accessibility_mode)
13 : root_(root), 14 : root_(root),
14 cycle_(cycle), 15 cycle_(cycle),
15 accessibility_mode_(accessibility_mode) { 16 accessibility_mode_(accessibility_mode) {
16 } 17 }
17 18
18 View* FocusSearch::FindNextFocusableView(View* starting_view, 19 View* FocusSearch::FindNextFocusableView(View* starting_view,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return NULL; 93 return NULL;
93 } 94 }
94 95
95 bool FocusSearch::IsViewFocusableCandidate(View* v, int skip_group_id) { 96 bool FocusSearch::IsViewFocusableCandidate(View* v, int skip_group_id) {
96 return IsFocusable(v) && 97 return IsFocusable(v) &&
97 (v->IsGroupFocusTraversable() || skip_group_id == -1 || 98 (v->IsGroupFocusTraversable() || skip_group_id == -1 ||
98 v->GetGroup() != skip_group_id); 99 v->GetGroup() != skip_group_id);
99 } 100 }
100 101
101 bool FocusSearch::IsFocusable(View* v) { 102 bool FocusSearch::IsFocusable(View* v) {
102 if (accessibility_mode_) 103 if (accessibility_mode_ ||
104 root_->GetWidget()->GetFocusManager()->IsKeyboardAccessibilityEnabled())
103 return v && v->IsAccessibilityFocusable(); 105 return v && v->IsAccessibilityFocusable();
104 return v && v->IsFocusable(); 106 return v && v->IsFocusable();
105 } 107 }
106 108
107 View* FocusSearch::FindSelectedViewForGroup(View* view) { 109 View* FocusSearch::FindSelectedViewForGroup(View* view) {
108 if (view->IsGroupFocusTraversable() || 110 if (view->IsGroupFocusTraversable() ||
109 view->GetGroup() == -1) // No group for that view. 111 view->GetGroup() == -1) // No group for that view.
110 return view; 112 return view;
111 113
112 View* selected_view = view->GetSelectedViewForGroup(view->GetGroup()); 114 View* selected_view = view->GetSelectedViewForGroup(view->GetGroup());
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 skip_group_id, 268 skip_group_id,
267 focus_traversable, 269 focus_traversable,
268 focus_traversable_view); 270 focus_traversable_view);
269 } 271 }
270 272
271 // We found nothing. 273 // We found nothing.
272 return NULL; 274 return NULL;
273 } 275 }
274 276
275 } // namespace views 277 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698