Chromium Code Reviews| Index: ui/views/window/dialog_client_view.cc |
| diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc |
| index 5d543a7572efe2b85b8772f293c766cbdb19430f..e8c3838015e85c9ef1d79c1ce38ad4998a422b92 100644 |
| --- a/ui/views/window/dialog_client_view.cc |
| +++ b/ui/views/window/dialog_client_view.cc |
| @@ -319,6 +319,7 @@ void DialogClientView::SetupLayout() { |
| base::AutoReset<bool> auto_reset(&adding_or_removing_views_, true); |
| GridLayout* layout = new GridLayout(button_row_container_); |
| layout->set_minimum_size(minimum_size_); |
| + default_focus_ = GetDialogDelegate()->GetInitiallyFocusedView(); |
|
sky
2017/04/28 20:49:52
There should be no need for the member as it's onl
ackermanb
2017/05/17 17:20:54
Done.
|
| // Clobber any existing LayoutManager since it has weak references to child |
| // Views which may be removed by SetupViews(). |
| @@ -399,6 +400,12 @@ void DialogClientView::SetupLayout() { |
| column_set->LinkColumnSizes(link[0], link[1], link[2], -1); |
| } |
| layout->AddPaddingRow(kFixed, insets.bottom()); |
| + |
| + // The default focus is lost when child views are added back into the dialog. |
| + // This restores focus to the default. |
| + if (default_focus_) { |
| + default_focus_->RequestFocus(); |
| + } |
| } |
| void DialogClientView::SetupViews() { |