Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| index baa1b13382970de78dc8079803885eee1d52639b..430123958a47155584b31a3701ed8256b08b384f 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
| @@ -744,7 +744,8 @@ void ProfileChooserView::ShowBubble( |
| const signin::ManageAccountsParams& manage_accounts_params, |
| signin_metrics::AccessPoint access_point, |
| views::View* anchor_view, |
| - Browser* browser) { |
| + Browser* browser, |
| + bool focus_first_profile_button) { |
| // Don't start creating the view if it would be an empty fast user switcher. |
| // It has to happen here to prevent the view system from creating an empty |
| // container. |
| @@ -772,6 +773,9 @@ void ProfileChooserView::ShowBubble( |
| profile_bubble_->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
| widget->Show(); |
| + if (focus_first_profile_button) { |
|
sky
2017/02/09 20:17:39
no {}
sky
2017/02/09 20:17:39
It seems unnecessary to store this view. Can't you
jlebel
2017/02/10 12:13:43
There are different buttons in this menu. The begi
|
| + profile_bubble_->FocusFirstProfileButton(); |
| + } |
| } |
| // static |
| @@ -832,6 +836,7 @@ void ProfileChooserView::ResetView() { |
| current_profile_photo_ = nullptr; |
| current_profile_name_ = nullptr; |
| current_profile_card_ = nullptr; |
| + first_profile_button_ = nullptr; |
| guest_profile_button_ = nullptr; |
| users_button_ = nullptr; |
| go_incognito_button_ = nullptr; |
| @@ -1003,6 +1008,12 @@ void ProfileChooserView::ShowViewFromMode(profiles::BubbleViewMode mode) { |
| } |
| } |
| +void ProfileChooserView::FocusFirstProfileButton() { |
| + if (first_profile_button_) { |
|
sky
2017/02/09 20:17:39
no {}
jlebel
2017/02/10 12:13:43
Done.
|
| + first_profile_button_->RequestFocus(); |
| + } |
| +} |
| + |
| void ProfileChooserView::WindowClosing() { |
| DCHECK_EQ(profile_bubble_, this); |
| profile_bubble_ = NULL; |
| @@ -1918,6 +1929,9 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock, |
| button->SetImageLabelSpacing(kMaterialMenuEdgeMargin); |
| open_other_profile_indexes_map_[button] = i; |
| + if (!first_profile_button_) { |
| + first_profile_button_ = button; |
| + } |
| layout->StartRow(1, 0); |
| layout->AddView(button); |
| } |