Commit 1038e2cc authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

macOS: Setting focus to the first profile in profile switcher

When opening the profile switcher menu using the shortcut (cmd-shift-m), the first
profile (other than the current one) in the list should be highlighted. This should
happens only when opening the menu with the keyboard (and not with the mouse).

This was done with Cocoa implementation: crrev.com/2638853003
It should have been done when moving the profile chooser menu to views-toolkit:
crrev.com/c/750901

Bug: 728141
Change-Id: I724d08ce626ec88144edabe7d928d8315606fd71
Reviewed-on: https://chromium-review.googlesource.com/771753
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517052}
parent 60250c04
......@@ -49,9 +49,12 @@ std::unique_ptr<ProfileChooserViewBridge> ShowProfileChooserViews(
anchor_rect.Inset(kBubbleInsets);
gfx::NativeView anchor_window =
platform_util::GetViewForWindow(browser->window()->GetNativeWindow());
// Select the first other profile if the menu is opened by the keyboard
// shortcut.
bool is_source_keyboard = [[NSApp currentEvent] type] == NSKeyDown;
ProfileChooserView::ShowBubble(
bubble_view_mode, signin::ManageAccountsParams(), access_point, nullptr,
anchor_window, anchor_rect, browser, false);
anchor_window, anchor_rect, browser, is_source_keyboard);
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
std::unique_ptr<ProfileChooserViewBridge> bridge(new ProfileChooserViewBridge(
avatar_base_controller, ProfileChooserView::GetCurrentBubbleWidget()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment