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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm

Issue 869793004: Bring up the Fast User Switcher on Shift+Click on the new Avatar Button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase before submit Created 5 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/cocoa/profiles/profile_chooser_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index a33bfa9539cacf64857d1aeabedf014efa54287a..2c8a22324cf495473a723774790156fe4271c5b1 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -1211,6 +1211,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
subView = [self buildSwitchUserView];
break;
case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER:
+ case profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER:
case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT:
subView = [self buildProfileChooserView];
break;
@@ -1243,6 +1244,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[[NSMutableArray alloc] init]);
// Local and guest profiles cannot lock their profile.
bool displayLock = false;
+ bool isFastProfileChooser =
+ viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
// Loop over the profiles in reverse, so that they are sorted by their
// y-coordinate, and separate them into active and "other" profiles.
@@ -1278,19 +1281,21 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// overlap the bubble's rounded corners.
CGFloat yOffset = 1;
- // Option buttons.
- NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0);
- NSView* optionsView = [self createOptionsViewWithRect:rect
- displayLock:displayLock];
- [container addSubview:optionsView];
- rect.origin.y = NSMaxY([optionsView frame]);
+ if (!isFastProfileChooser) {
+ // Option buttons.
+ NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0);
+ NSView* optionsView = [self createOptionsViewWithRect:rect
+ displayLock:displayLock];
+ [container addSubview:optionsView];
+ rect.origin.y = NSMaxY([optionsView frame]);
- NSBox* separator = [self horizontalSeparatorWithFrame:rect];
- [container addSubview:separator];
- yOffset = NSMaxY([separator frame]);
+ NSBox* separator = [self horizontalSeparatorWithFrame:rect];
+ [container addSubview:separator];
+ yOffset = NSMaxY([separator frame]);
+ }
- if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER &&
- switches::IsFastUserSwitching()) {
+ if ((viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER &&
+ switches::IsFastUserSwitching()) || isFastProfileChooser) {
// Other profiles switcher. The profiles have already been sorted
// by their y-coordinate, so they can be added in the existing order.
for (NSView *otherProfileView in otherProfiles.get()) {
@@ -1333,14 +1338,14 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
}
// Active profile card.
- if (currentProfileView) {
+ if (!isFastProfileChooser && currentProfileView) {
yOffset += kVerticalSpacing;
[currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)];
[container addSubview:currentProfileView];
yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing;
}
- if (tutorialView) {
+ if (!isFastProfileChooser && tutorialView) {
[tutorialView setFrameOrigin:NSMakePoint(0, yOffset)];
[container addSubview:tutorialView];
yOffset = NSMaxY([tutorialView frame]);
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm ('k') | chrome/browser/ui/profile_chooser_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698