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

Unified Diff: ui/views/focus/focus_manager.h

Issue 1894383002: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SetFocusBehavior
Patch Set: Rebased Created 4 years, 7 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
Index: ui/views/focus/focus_manager.h
diff --git a/ui/views/focus/focus_manager.h b/ui/views/focus/focus_manager.h
index debdbe98fff1154e3c3933b9d370ab1dc9462a04..99ca6e6772662baf0446feffbe3bf6e705ba6e19 100644
--- a/ui/views/focus/focus_manager.h
+++ b/ui/views/focus/focus_manager.h
@@ -201,7 +201,8 @@ class VIEWS_EXPORT FocusManager {
// Restore the view saved with a previous call to StoreFocusedView(). Used
// when the widget becomes active. Returns true when the previous view was
- // successfully refocused - otherwise false.
+ // successfully refocused. In case the stored view is no longer focusable,
+ // it advances focus and returns false.
bool RestoreFocusedView();
// Sets the |view| to be restored when calling RestoreFocusView. This is used
@@ -319,6 +320,12 @@ class VIEWS_EXPORT FocusManager {
bool reverse,
bool dont_loop);
+ bool keyboard_accessible() const { return keyboard_accessible_; }
+
+ // Updates |keyboard_accessible_| to the given value and advances focus if
+ // necessary.
+ void SetKeyboardAccessible(bool keyboard_accessible);
+
private:
// Returns the focusable view found in the FocusTraversable specified starting
// at the specified view. This traverses down along the FocusTraversable
@@ -332,6 +339,10 @@ class VIEWS_EXPORT FocusManager {
// and should not be processed further.
bool ProcessArrowKeyTraversal(const ui::KeyEvent& event);
+ // Whether |view| is currently focusable as per the platform's interpretation
+ // of |keyboard_accesible_|.
+ bool IsFocusable(View* view) const;
+
// Whether arrow key traversal is enabled.
static bool arrow_key_traversal_enabled_;
@@ -364,6 +375,15 @@ class VIEWS_EXPORT FocusManager {
// See description above getter.
bool is_changing_focus_;
+ // This is true if full keyboard accessibility is needed. This causes
+ // IsAccessibilityFocusable() to be checked rather than IsFocusable(). This
+ // can be set depending on platform constraints. FocusSearch uses this in
+ // addition to its own accessibility mode, which handles accessibility at the
+ // FocusTraversable level. Currently only used on Mac, when Full Keyboard
+ // access is enabled.
+ // Default value is false.
+ bool keyboard_accessible_;
+
DISALLOW_COPY_AND_ASSIGN(FocusManager);
};

Powered by Google App Engine
This is Rietveld 408576698