Index: ui/views/view.h |
diff --git a/ui/views/view.h b/ui/views/view.h |
index 9bdf84053dd1ea679a12921ec761d3631ab6a3c2..947d356a266b217ebfcd3779e9c570c9502d275c 100644 |
--- a/ui/views/view.h |
+++ b/ui/views/view.h |
@@ -277,7 +277,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// as with Labels). |
virtual int GetHeightForWidth(int w); |
- // Set whether this view is visible. Painting is scheduled as needed. |
+ // Sets whether this view is visible. Painting is scheduled as needed. Also, |
+ // clears focus if the focused view or one of its ancestors is set to be |
+ // hidden. |
virtual void SetVisible(bool visible); |
// Return whether a view is visible |
@@ -288,7 +290,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Set whether this view is enabled. A disabled view does not receive keyboard |
// or mouse inputs. If |enabled| differs from the current value, SchedulePaint |
- // is invoked. |
+ // is invoked. Also, clears focus if the focused view is disabled. |
void SetEnabled(bool enabled); |
// Returns whether the view is enabled. |
@@ -765,10 +767,11 @@ 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. |
+ // 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 set_focusable(bool focusable) { focusable_ = focusable; } |
+ void SetFocusable(bool focusable); |
// Returns true if this view is capable of taking focus. |
bool focusable() const { return focusable_ && enabled_ && visible_; } |
@@ -781,11 +784,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
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. |
+ // 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 set_accessibility_focusable(bool accessibility_focusable) { |
- accessibility_focusable_ = accessibility_focusable; |
- } |
+ 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 |
@@ -1390,6 +1392,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// to the view at the specified index. |
void InitFocusSiblings(View* view, int index); |
+ // Clears the focused view if it has become unfocusable. |
+ void ClearFocusIfUnfocusable(); |
+ |
// System events ------------------------------------------------------------- |
// Used to propagate theme changed notifications from the root view to all |