Chromium Code Reviews| Index: ui/views/widget/widget.cc |
| diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc |
| index 08578add8f534fe637481183fd005dbc34a58a1c..bbd129c4a9964da5f48e98cc5a60431418122df2 100644 |
| --- a/ui/views/widget/widget.cc |
| +++ b/ui/views/widget/widget.cc |
| @@ -1303,17 +1303,23 @@ const Widget* Widget::AsWidget() const { |
| } |
| bool Widget::SetInitialFocus(ui::WindowShowState show_state) { |
| + FocusManager* focus_manager = GetFocusManager(); |
| View* v = widget_delegate_->GetInitiallyFocusedView(); |
| if (!focus_on_creation_ || show_state == ui::SHOW_STATE_INACTIVE || |
| show_state == ui::SHOW_STATE_MINIMIZED) { |
| // If not focusing the window now, tell the focus manager which view to |
| // focus when the window is restored. |
| - if (v && focus_manager_.get()) |
| - focus_manager_->SetStoredFocusView(v); |
| + if (v && focus_manager) |
| + focus_manager->SetStoredFocusView(v); |
| return true; |
| } |
| - if (v) |
| + if (v) { |
| v->RequestFocus(); |
| + // If the request for focus was unsuccessful, fall back to using the first |
| + // focusable View instead. |
| + if (focus_manager && v != focus_manager->GetFocusedView()) |
|
sky
2017/01/12 16:34:13
Rather than checking |v|, how about checking for n
Patti Lor
2017/01/13 04:19:02
Done, thanks.
|
| + focus_manager->AdvanceFocus(false); |
| + } |
| return !!v; |
|
sky
2017/01/12 16:34:13
The return value should be true if any view got fo
Patti Lor
2017/01/13 04:19:02
Done.
|
| } |