Chromium Code Reviews| Index: ui/views/view.cc |
| diff --git a/ui/views/view.cc b/ui/views/view.cc |
| index 60d8e8903e3da79516583d4539c5417e9c6f177e..9993fcc3504574f97511ecca8519809464d4a441 100644 |
| --- a/ui/views/view.cc |
| +++ b/ui/views/view.cc |
| @@ -1199,12 +1199,21 @@ void View::SetNextFocusableView(View* view) { |
| next_focusable_view_ = view; |
| } |
| -void View::SetFocusable(bool focusable) { |
| - if (focusable_ == focusable) |
| - return; |
| - |
| - focusable_ = focusable; |
| - AdvanceFocusIfNecessary(); |
| +void View::SetFocusBehavior(FocusBehavior focus_behavior) { |
| + switch (focus_behavior) { |
|
tapted
2016/04/20 04:16:28
since SetFocusable/SetAccessibilityFocusable are b
karandeepb
2016/04/21 03:16:33
Yeah should have thought of this. Thanks.
|
| + case FocusBehavior::ALWAYS: |
| + SetFocusable(true); |
| + SetAccessibilityFocusable(true); |
| + break; |
| + case FocusBehavior::NEVER: |
| + SetFocusable(false); |
| + SetAccessibilityFocusable(false); |
| + break; |
| + case FocusBehavior::ACCESSIBLE_ONLY: |
| + SetFocusable(false); |
| + SetAccessibilityFocusable(true); |
| + break; |
| + } |
| } |
| bool View::IsFocusable() const { |
| @@ -1215,14 +1224,6 @@ bool View::IsAccessibilityFocusable() const { |
| return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); |
| } |
| -void View::SetAccessibilityFocusable(bool accessibility_focusable) { |
| - if (accessibility_focusable_ == accessibility_focusable) |
| - return; |
| - |
| - accessibility_focusable_ = accessibility_focusable; |
| - AdvanceFocusIfNecessary(); |
| -} |
| - |
| FocusManager* View::GetFocusManager() { |
| Widget* widget = GetWidget(); |
| return widget ? widget->GetFocusManager() : NULL; |
| @@ -2309,6 +2310,22 @@ void View::UnregisterAccelerators(bool leave_data_intact) { |
| // Focus ----------------------------------------------------------------------- |
| +void View::SetFocusable(bool focusable) { |
| + if (focusable_ == focusable) |
| + return; |
| + |
| + focusable_ = focusable; |
| + AdvanceFocusIfNecessary(); |
| +} |
| + |
| +void View::SetAccessibilityFocusable(bool accessibility_focusable) { |
| + if (accessibility_focusable_ == accessibility_focusable) |
| + return; |
| + |
| + accessibility_focusable_ = accessibility_focusable; |
| + AdvanceFocusIfNecessary(); |
| +} |
| + |
| void View::InitFocusSiblings(View* v, int index) { |
| int count = child_count(); |