Chromium Code Reviews| Index: ui/views/view.h |
| diff --git a/ui/views/view.h b/ui/views/view.h |
| index 5a50125a9f4d8d95c6bca1b82df8836550f62fa6..dfe0292d19ffe598fbdcf7287b1fefd67f0e6bf1 100644 |
| --- a/ui/views/view.h |
| +++ b/ui/views/view.h |
| @@ -116,6 +116,18 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| public: |
| typedef std::vector<View*> Views; |
| + enum class FocusBehavior { |
|
sky
2016/04/18 15:40:24
Can you please separate out the FocusBehavior into
|
| + // Use when the view is to be focusable both in default and full keyboard |
| + // access mode. |
| + ALWAYS, |
| + |
| + // Use when view is never focusable. Default. |
| + NEVER, |
| + |
| + // Use when the view is to be made focusable only during full keyboard mode. |
| + ACCESSIBLE_ONLY, |
| + }; |
| + |
| struct ViewHierarchyChangedDetails { |
| ViewHierarchyChangedDetails() |
| : is_add(false), |
| @@ -767,11 +779,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // IMPORTANT NOTE: loops in the focus hierarchy are not supported. |
| void SetNextFocusableView(View* view); |
| - // Sets whether this view is capable of taking focus. It will clear focus if |
| - // the focused view is set to be non-focusable. |
| - // Note that this is false by default so that a view used as a container does |
| - // not get the focus. |
| - void SetFocusable(bool focusable); |
| + // Sets |focusable_| and |accessibility_focusable_| corresponding to the given |
| + // |focus_behavior|. |
| + void SetFocusBehavior(FocusBehavior focus_behavior); |
| // Returns true if this view is |focusable_|, |enabled_| and drawn. |
| bool IsFocusable() const; |
| @@ -780,12 +790,6 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // access, even though it may not be normally focusable. |
| bool IsAccessibilityFocusable() const; |
| - // Set whether this view can be made focusable if the user requires |
| - // full keyboard access, even though it's not normally focusable. It will |
| - // clear focus if the focused view is set to be non-focusable. |
| - // Note that this is false by default. |
| - void SetAccessibilityFocusable(bool accessibility_focusable); |
| - |
| // Convenience method to retrieve the FocusManager associated with the |
| // Widget that contains this view. This can return NULL if this view is not |
| // part of a view hierarchy with a Widget. |
| @@ -1145,6 +1149,11 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // if a view can take focus right now. |
| bool focusable() const { return focusable_; } |
| + // Returns last value passed to SetAccessibilityFocusable(). Use |
| + // IsAccessibilityFocusable() to determine if a view can take focus right now |
| + // in accessibility mode. |
| + bool accessibility_focusable() const { return accessibility_focusable_; } |
| + |
| // Override to be notified when focus has changed either to or from this View. |
| virtual void OnFocus(); |
| virtual void OnBlur(); |
| @@ -1384,6 +1393,20 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
| // Focus --------------------------------------------------------------------- |
| + // Helper method for SetFocusBehavior(..). |
| + // Sets whether this view is capable of taking focus. It will clear focus if |
| + // the focused view is set to be non-focusable. |
| + // Note that this is false by default so that a view used as a container does |
| + // not get the focus. |
| + void SetFocusable(bool focusable); |
| + |
| + // Helper method for SetFocusBehavior(..). |
| + // Set whether this view can be made focusable if the user requires |
| + // full keyboard access, even though it's not normally focusable. It will |
| + // clear focus if the focused view is set to be non-focusable. |
| + // Note that this is false by default. |
| + void SetAccessibilityFocusable(bool accessibility_focusable); |
| + |
| // Initialize the previous/next focusable views of the specified view relative |
| // to the view at the specified index. |
| void InitFocusSiblings(View* view, int index); |