Index: ui/views/view.h |
diff --git a/ui/views/view.h b/ui/views/view.h |
index 5a50125a9f4d8d95c6bca1b82df8836550f62fa6..9412b29396a7cf4229c9e644f769403e126645b3 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 { |
+ // Use when the view is to be focusable both in default and full keyboard |
tapted
2016/04/20 04:16:28
nit: view -> View. Also `full keyboard access` is
karandeepb
2016/04/21 03:16:33
Done. Although the existing comment for IsAccessib
|
+ // access mode. |
+ ALWAYS, |
+ |
+ // Use when view is never focusable. Default. |
tapted
2016/04/20 04:16:28
nit: view -> View. Also the default should come fi
sky
2016/04/20 19:26:02
And 'view' -> 'the view'
karandeepb
2016/04/21 03:16:33
Done.
karandeepb
2016/04/21 03:16:33
Done.
|
+ NEVER, |
+ |
+ // Use when the view is to be made focusable only during full keyboard mode. |
tapted
2016/04/20 04:16:28
// The View is focusable only in accessibility mod
karandeepb
2016/04/21 03:16:33
Done.
|
+ 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|. |
tapted
2016/04/20 04:16:28
If we get rid of Set[Accessibility]Focusable (I th
karandeepb
2016/04/21 03:16:33
Done.
|
+ 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. |
@@ -1384,6 +1388,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); |
sky
2016/04/20 19:26:02
Is this temporary? We should only have SetFocusBeh
karandeepb
2016/04/21 03:16:33
Done.
|
+ |
+ // Helper method for SetFocusBehavior(..). |
+ // Set whether this view can be made focusable if the user requires |
tapted
2016/04/20 04:16:28
nit: rewrap
karandeepb
2016/04/21 03:16:33
Removed this.
|
+ // 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); |