Index: ui/views/view.cc |
diff --git a/ui/views/view.cc b/ui/views/view.cc |
index f74d0f9e79014748448da8bbece2de023ab2217d..9d2b31c9d453e14307619cd7858c1552d9af9654 100644 |
--- a/ui/views/view.cc |
+++ b/ui/views/view.cc |
@@ -453,6 +453,7 @@ void View::SetVisible(bool visible) { |
SchedulePaint(); |
visible_ = visible; |
+ ClearFocusIfUnfocusable(); |
// Notify the parent. |
if (parent_) |
@@ -475,6 +476,7 @@ bool View::IsDrawn() const { |
void View::SetEnabled(bool enabled) { |
if (enabled != enabled_) { |
enabled_ = enabled; |
+ ClearFocusIfUnfocusable(); |
OnEnabledChanged(); |
} |
} |
@@ -1205,6 +1207,11 @@ void View::SetNextFocusableView(View* view) { |
next_focusable_view_ = view; |
} |
+void View::SetFocusable(bool focusable) { |
+ focusable_ = focusable; |
sky
2013/12/11 21:29:29
early out if didn't change.
mohsen
2013/12/12 18:26:54
Done.
|
+ ClearFocusIfUnfocusable(); |
+} |
+ |
bool View::IsFocusable() const { |
return focusable_ && enabled_ && IsDrawn(); |
} |
@@ -1213,6 +1220,11 @@ bool View::IsAccessibilityFocusable() const { |
return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); |
} |
+void View::SetAccessibilityFocusable(bool accessibility_focusable) { |
+ accessibility_focusable_ = accessibility_focusable; |
sky
2013/12/11 21:29:29
early out if didn't change.
mohsen
2013/12/12 18:26:54
Done.
|
+ ClearFocusIfUnfocusable(); |
+} |
+ |
FocusManager* View::GetFocusManager() { |
Widget* widget = GetWidget(); |
return widget ? widget->GetFocusManager() : NULL; |
@@ -2336,6 +2348,12 @@ void View::InitFocusSiblings(View* v, int index) { |
} |
} |
+void View::ClearFocusIfUnfocusable() { |
+ FocusManager* focus_manager = GetFocusManager(); |
+ if (focus_manager) |
+ focus_manager->ClearFocusIfUnfocusable(); |
+} |
+ |
// System events --------------------------------------------------------------- |
void View::PropagateThemeChanged() { |