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

Unified Diff: ui/views/view.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failing tests. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 4c62a000f61882cf5115a2f541ba8e7b86fb8af5..05892f1320f571f36c69046786fca7a41bedbe6f 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -1201,6 +1201,34 @@ void View::SetNextFocusableView(View* view) {
next_focusable_view_ = view;
}
+void View::SetFocusBehavior(FocusBehavior focus_behavior) {
+ if (focus_behavior == FocusBehavior::CONTROL) {
+#if defined(OS_MACOSX)
+ focus_behavior = FocusBehavior::ACCESSIBLE_ONLY;
+#else
+ focus_behavior = FocusBehavior::ALWAYS;
+#endif
+ }
+
+ switch (focus_behavior) {
+ case FocusBehavior::ALWAYS:
+ SetFocusable(true);
+ SetAccessibilityFocusable(true);
+ break;
+ case FocusBehavior::NEVER:
+ SetFocusable(false);
+ SetAccessibilityFocusable(false);
+ break;
+ case FocusBehavior::ACCESSIBLE_ONLY:
+ SetFocusable(false);
+ SetAccessibilityFocusable(true);
+ break;
+ case FocusBehavior::CONTROL:
+ NOTREACHED();
+ break;
+ }
+}
+
void View::SetFocusable(bool focusable) {
if (focusable_ == focusable)
return;
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698