Commit 6b24b79e authored by anthonyvd's avatar anthonyvd Committed by Commit bot

Show user menu on right-click of the avatar button when MaterialDesignUserMenu is enabled.

BUG=657291

Review-Url: https://codereview.chromium.org/2478523003
Cr-Commit-Position: refs/heads/master@{#430360}
parent f052abfe
......@@ -1563,8 +1563,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[[NSMutableArray alloc] init]);
// Local and guest profiles cannot lock their profile.
bool showLock = false;
bool isFastProfileChooser =
viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
bool isFastProfileChooser = switches::IsMaterialDesignUserMenu() ?
false : viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
if (isFastProfileChooser) {
// The user is using right-click switching, no need to tell them about it.
PrefService* localState = g_browser_process->local_state();
......@@ -1601,11 +1601,9 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
CGFloat yOffset = 1;
if (isFastProfileChooser) {
if (!switches::IsMaterialDesignUserMenu()) {
[self buildFastUserSwitcherViewWithProfiles:otherProfiles.get()
atYOffset:yOffset
inContainer:container];
}
[self buildFastUserSwitcherViewWithProfiles:otherProfiles.get()
atYOffset:yOffset
inContainer:container];
} else {
[self buildProfileChooserViewWithProfileView:currentProfileView
tutorialView:tutorialView
......
......@@ -698,14 +698,18 @@ void ProfileChooserView::ShowBubble(
signin_metrics::AccessPoint access_point,
views::View* anchor_view,
Browser* browser) {
if (switches::IsMaterialDesignUserMenu()) {
// The Material Design User Menu doesn't have a fast user switcher on
// right-click. To ease up the transition for users, show the regular user
// menu when right-clicking instead of doing nothing.
view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
}
// 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.
// Same for material design user menu since fast profile switcher will be
// migrated to the left-click menu.
if (view_mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
(!profiles::HasProfileSwitchTargets(browser->profile()) ||
switches::IsMaterialDesignUserMenu())) {
!profiles::HasProfileSwitchTargets(browser->profile())) {
return;
}
......
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