Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2687693002: Linux/Windows: Setting focus to the first profile in profile switcher (Closed)
Patch Set: Renaming |focus_first_profile| to |is_source_keyboard| Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e1f40f7308f8a8759e1d5126300b3196ad59b951..bfb304eddfd0a386491117d4e897d0f03f2d0870 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -758,7 +758,8 @@ void ProfileChooserView::ShowBubble(
const signin::ManageAccountsParams& manage_accounts_params,
signin_metrics::AccessPoint access_point,
views::View* anchor_view,
- Browser* browser) {
+ Browser* browser,
+ bool is_source_keyboard) {
// 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.
@@ -786,6 +787,8 @@ void ProfileChooserView::ShowBubble(
profile_bubble_->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
profile_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
widget->Show();
+ if (is_source_keyboard)
+ profile_bubble_->FocusFirstProfileButton();
}
// static
@@ -846,6 +849,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;
@@ -1017,6 +1021,11 @@ void ProfileChooserView::ShowViewFromMode(profiles::BubbleViewMode mode) {
}
}
+void ProfileChooserView::FocusFirstProfileButton() {
+ if (first_profile_button_)
+ first_profile_button_->RequestFocus();
+}
+
void ProfileChooserView::WindowClosing() {
DCHECK_EQ(profile_bubble_, this);
profile_bubble_ = NULL;
@@ -1933,6 +1942,8 @@ 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);
}

Powered by Google App Engine
This is Rietveld 408576698