Chromium Code Reviews| 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 62b634fecd91984bf3e082ea20ad01bf59b94d7a..05c52115efe8fd52c9dffa6c3602b51a0401e9b1 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| @@ -94,7 +94,6 @@ namespace { |
| // Constants taken from the Windows/Views implementation at: |
| // chrome/browser/ui/views/profile_chooser_view.cc |
| const int kLargeImageSide = 88; |
| -const int kSmallImageSide = 32; |
| const int kMdImageSide = 40; |
| const CGFloat kVerticalSpacing = 16.0; |
| @@ -105,7 +104,6 @@ const CGFloat kTitleFontSize = 15.0; |
| const CGFloat kTextFontSize = 12.0; |
| const CGFloat kProfileButtonHeight = 30; |
| const int kBezelThickness = 3; // Width of the bezel on an NSButton. |
| -const int kImageTitleSpacing = 10; |
| const int kBlueButtonHeight = 30; |
| const CGFloat kFocusRingLineWidth = 2; |
| @@ -122,7 +120,7 @@ const int kFixedSwitchUserViewWidth = 320; |
| const int kPrimaryProfileTag = -1; |
| CGFloat GetFixedMenuWidth() { |
|
msarda
2017/02/23 11:51:02
Nit: This should not be a constant named kFixedMen
jlebel
2017/02/23 18:18:49
Done.
|
| - return switches::IsMaterialDesignUserMenu() ? 240.0 : 250.0; |
| + return 240.0; |
| } |
| NSImage* CreateProfileImage(const gfx::Image& icon, |
| @@ -861,8 +859,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| initWithLeftMarginSpacing:kHorizontalSpacing |
| imageTitleSpacing:imageTitleSpacing]); |
| [cell setLineBreakMode:NSLineBreakByTruncatingTail]; |
| - if (switches::IsMaterialDesignUserMenu()) |
| - [cell setHighlightsBy:NSNoCellMask]; |
| + [cell setHighlightsBy:NSNoCellMask]; |
| [self setCell:cell.get()]; |
| } |
| return self; |
| @@ -965,8 +962,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // Builds the profile chooser view. |
| - (NSView*)buildProfileChooserView; |
| -- (NSView*)buildTutorialViewIfNeededForItem:(const AvatarMenu::Item&)item; |
| - |
| // Builds a tutorial card with a title label using |titleMessage|, a content |
| // label using |contentMessage|, a link using |linkMessage|, and a button using |
| // |buttonMessage|. If |stackButton| is YES, places the button above the link. |
| @@ -1006,7 +1001,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // Creates the main profile card for the profile |item| at the top of |
| // the bubble, for non-material-design and material design user menu |
| // respectively. |
| -- (NSView*)createCurrentProfileView:(const AvatarMenu::Item&)item; |
| - (NSView*)createMaterialDesignCurrentProfileView:(const AvatarMenu::Item&)item; |
| // Creates the possible links for the main profile card with profile |item|. |
| @@ -1024,10 +1018,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // switcher view. |
| - (NSButton*)createOtherProfileView:(int)itemIndex; |
| -// Creates the following option buttons: lock profile, go incognito, and switch |
| -// user/exit guest. |
| -- (NSView*)createOptionsViewWithRect:(NSRect)rect |
| - showLock:(BOOL)showLock; |
| // For material design user menu, creates the following option buttons: lock |
| // profile/close all windows, switch user/exit guest, and open guest profile. |
| - (NSView*)createMaterialDesignOptionsViewWithFrame:(NSRect)frame |
| @@ -1450,9 +1440,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| [otherProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| [container addSubview:otherProfileView]; |
| yOffset = NSMaxY([otherProfileView frame]); |
| - |
| - if (!switches::IsMaterialDesignUserMenu()) |
| - yOffset = [self addSeparatorToContainer:container atYOffset:yOffset]; |
| } |
| [container setFrameSize:NSMakeSize(GetFixedMenuWidth(), yOffset)]; |
| @@ -1466,28 +1453,22 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| atYOffset:(CGFloat)yOffset |
| inContainer:(NSView*)container |
| showLock:(bool)showLock { |
| - if (switches::IsMaterialDesignUserMenu()) |
| - yOffset += kRelatedControllVerticalSpacing; |
| + yOffset += kRelatedControllVerticalSpacing; |
| // Option buttons. |
| NSRect rect = NSMakeRect(0, yOffset, GetFixedMenuWidth(), 0); |
| NSView* optionsView = |
| - switches::IsMaterialDesignUserMenu() |
| - ? [self createMaterialDesignOptionsViewWithFrame:rect |
| - showLock:showLock] |
| - : [self createOptionsViewWithRect:rect showLock:showLock]; |
| + [self createMaterialDesignOptionsViewWithFrame:rect showLock:showLock]; |
| [container addSubview:optionsView]; |
| rect.origin.y = NSMaxY([optionsView frame]); |
| yOffset = rect.origin.y; |
| - // For material design user menu, add the fast user switching buttons. |
| - if (switches::IsMaterialDesignUserMenu()) { |
| - yOffset = [self buildFastUserSwitcherViewWithProfiles:otherProfiles |
| - atYOffset:yOffset |
| - inContainer:container]; |
| - yOffset += kRelatedControllVerticalSpacing; |
| - rect.origin.y = yOffset; |
| - } |
| + // Add the fast user switching buttons. |
| + yOffset = [self buildFastUserSwitcherViewWithProfiles:otherProfiles |
| + atYOffset:yOffset |
| + inContainer:container]; |
| + yOffset += kRelatedControllVerticalSpacing; |
| + rect.origin.y = yOffset; |
| NSBox* separator = [self horizontalSeparatorWithFrame:rect]; |
| [container addSubview:separator]; |
| @@ -1495,17 +1476,11 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // For supervised users, add the disclaimer text. |
| if (browser_->profile()->IsSupervised()) { |
| - yOffset += switches::IsMaterialDesignUserMenu() ? kVerticalSpacing |
| - : kSmallVerticalSpacing; |
| + yOffset += kVerticalSpacing; |
| NSView* disclaimerContainer = [self createSupervisedUserDisclaimerView]; |
| [disclaimerContainer setFrameOrigin:NSMakePoint(0, yOffset)]; |
| [container addSubview:disclaimerContainer]; |
| yOffset = NSMaxY([disclaimerContainer frame]); |
| - |
| - if (!switches::IsMaterialDesignUserMenu()) { |
| - yOffset += kSmallVerticalSpacing; |
| - yOffset = [self addSeparatorToContainer:container atYOffset:yOffset]; |
| - } |
| } |
| if (viewMode_ == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) { |
| @@ -1529,9 +1504,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // Active profile card. |
| if (currentProfileView) { |
| - const CGFloat verticalSpacing = switches::IsMaterialDesignUserMenu() |
| - ? kRelatedControllVerticalSpacing |
| - : kVerticalSpacing; |
| + const CGFloat verticalSpacing = kRelatedControllVerticalSpacing; |
| yOffset += verticalSpacing; |
| [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| [container addSubview:currentProfileView]; |
| @@ -1582,15 +1555,8 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { |
| const AvatarMenu::Item& item = avatarMenu_->GetItemAt(i); |
| if (item.active) { |
| - if (switches::IsMaterialDesignUserMenu()) { |
| - syncErrorView = [self buildSyncErrorViewIfNeeded]; |
| - } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
| - tutorialView = [self buildTutorialViewIfNeededForItem:item]; |
| - } |
| - currentProfileView = |
| - switches::IsMaterialDesignUserMenu() |
| - ? [self createMaterialDesignCurrentProfileView:item] |
| - : [self createCurrentProfileView:item]; |
| + syncErrorView = [self buildSyncErrorViewIfNeeded]; |
| + currentProfileView = [self createMaterialDesignCurrentProfileView:item]; |
| showLock = item.signed_in && |
| profiles::IsLockAvailable(browser_->profile()); |
| } else { |
| @@ -1606,13 +1572,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // overlap the bubble's rounded corners. |
| CGFloat yOffset = 1; |
| - if (isFastProfileChooser) { |
| - if (!switches::IsMaterialDesignUserMenu()) { |
| - [self buildFastUserSwitcherViewWithProfiles:otherProfiles.get() |
| - atYOffset:yOffset |
| - inContainer:container]; |
| - } |
| - } else { |
| + if (!isFastProfileChooser) { |
| [self buildProfileChooserViewWithProfileView:currentProfileView |
| tutorialView:tutorialView |
| syncErrorView:syncErrorView |
| @@ -1716,32 +1676,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| buttonAction:@selector(dismissTutorial:)]; |
| } |
| -- (NSView*)buildTutorialViewIfNeededForItem:(const AvatarMenu::Item&)item { |
| - if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) |
| - return [self buildSigninConfirmationView]; |
| - |
| - if (tutorialMode_ == profiles::TUTORIAL_MODE_SHOW_ERROR) |
| - return [self buildSigninErrorView]; |
| - |
| - if (profiles::ShouldShowWelcomeUpgradeTutorial( |
| - browser_->profile(), tutorialMode_)) { |
| - if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
| - Profile* profile = browser_->profile(); |
| - const int showCount = profile->GetPrefs()->GetInteger( |
| - prefs::kProfileAvatarTutorialShown); |
| - profile->GetPrefs()->SetInteger( |
| - prefs::kProfileAvatarTutorialShown, showCount + 1); |
| - } |
| - |
| - return [self buildWelcomeUpgradeTutorialView:item]; |
| - } |
| - |
| - if (profiles::ShouldShowRightClickTutorial(browser_->profile())) |
| - return [self buildRightClickTutorialView]; |
| - |
| - return nil; |
| -} |
| - |
| - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
| titleMessage:(NSString*)titleMessage |
| contentMessage:(NSString*)contentMessage |
| @@ -1970,82 +1904,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| return container.autorelease(); |
| } |
| -- (NSView*)createCurrentProfileView:(const AvatarMenu::Item&)item { |
| - base::scoped_nsobject<NSView> container([[NSView alloc] |
| - initWithFrame:NSZeroRect]); |
| - |
| - CGFloat xOffset = kHorizontalSpacing; |
| - CGFloat yOffset = 0; |
| - CGFloat availableTextWidth = GetFixedMenuWidth() - 2 * kHorizontalSpacing; |
| - CGFloat maxAvailableTextWidth = GetFixedMenuWidth() - kHorizontalSpacing; |
| - |
| - // Profile options. This can be a link to the accounts view, the profile's |
| - // username for signed in users, or a "Sign in" button for local profiles. |
| - SigninManagerBase* signinManager = |
| - SigninManagerFactory::GetForProfile( |
| - browser_->profile()->GetOriginalProfile()); |
| - if (!isGuestSession_ && signinManager->IsSigninAllowed()) { |
| - NSView* linksContainer = [self |
| - createCurrentProfileLinksForItem:item |
| - rect:NSMakeRect(xOffset, yOffset, |
| - maxAvailableTextWidth, 0)]; |
| - [container addSubview:linksContainer]; |
| - yOffset = NSMaxY([linksContainer frame]); |
| - } |
| - |
| - // Profile name, centered. |
| - bool editingAllowed = !isGuestSession_ && |
| - !browser_->profile()->IsLegacySupervised(); |
| - base::scoped_nsobject<EditableProfileNameButton> profileName( |
| - [[EditableProfileNameButton alloc] |
| - initWithFrame:NSMakeRect(xOffset, |
| - yOffset, |
| - availableTextWidth, |
| - kProfileButtonHeight) |
| - profile:browser_->profile() |
| - profileName:base::SysUTF16ToNSString( |
| - profiles::GetAvatarNameForProfile( |
| - browser_->profile()->GetPath())) |
| - editingAllowed:editingAllowed |
| - withController:self]); |
| - |
| - [container addSubview:profileName]; |
| - yOffset = NSMaxY([profileName frame]) + 4; // Adds a small vertical padding. |
| - |
| - // Profile icon, centered. |
| - xOffset = (GetFixedMenuWidth() - kLargeImageSide) / 2; |
| - base::scoped_nsobject<EditableProfilePhoto> iconView( |
| - [[EditableProfilePhoto alloc] |
| - initWithFrame:NSMakeRect(xOffset, yOffset, |
| - kLargeImageSide, kLargeImageSide) |
| - avatarMenu:avatarMenu_.get() |
| - profileIcon:item.icon |
| - editingAllowed:!isGuestSession_ |
| - withController:self]); |
| - |
| - [container addSubview:iconView]; |
| - yOffset = NSMaxY([iconView frame]); |
| - |
| - if (browser_->profile()->IsSupervised()) { |
| - base::scoped_nsobject<NSImageView> supervisedIcon( |
| - [[NSImageView alloc] initWithFrame:NSZeroRect]); |
| - int imageId = browser_->profile()->IsChild() |
| - ? IDR_ICON_PROFILES_MENU_CHILD |
| - : IDR_ICON_PROFILES_MENU_LEGACY_SUPERVISED; |
| - ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| - [supervisedIcon setImage:rb->GetNativeImageNamed(imageId).ToNSImage()]; |
| - NSSize size = [[supervisedIcon image] size]; |
| - [supervisedIcon setFrameSize:size]; |
| - NSRect parentFrame = [iconView frame]; |
| - [supervisedIcon setFrameOrigin:NSMakePoint(NSMaxX(parentFrame) - size.width, |
| - NSMinY(parentFrame))]; |
| - [container addSubview:supervisedIcon]; |
| - } |
| - |
| - [container setFrameSize:NSMakeSize(GetFixedMenuWidth(), yOffset)]; |
| - return container.autorelease(); |
| -} |
| - |
| - (NSView*)createMaterialDesignCurrentProfileView: |
| (const AvatarMenu::Item&)item { |
| base::scoped_nsobject<NSView> container( |
| @@ -2185,15 +2043,13 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| - (NSView*)createCurrentProfileLinksForItem:(const AvatarMenu::Item&)item |
| rect:(NSRect)rect { |
| - if (switches::IsMaterialDesignUserMenu()) { |
| - // The branch is empty for material design user menu in non-account- |
| - // consistency mode, because in that case, the username would appear in the |
| - // profile card instead of as a separate link here. |
| - SigninManagerBase* signinManager = SigninManagerFactory::GetForProfile( |
| - browser_->profile()->GetOriginalProfile()); |
| - DCHECK((item.signed_in && switches::IsEnableAccountConsistency()) || |
| - (!item.signed_in && signinManager->IsSigninAllowed())); |
| - } |
| + // The branch is empty in non-account-consistency mode, because in that case, |
| + // the username would appear in the profile card instead of as a separate link |
| + // here. |
| + SigninManagerBase* signinManager = SigninManagerFactory::GetForProfile( |
| + browser_->profile()->GetOriginalProfile()); |
| + DCHECK((item.signed_in && switches::IsEnableAccountConsistency()) || |
| + (!item.signed_in && signinManager->IsSigninAllowed())); |
| base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
| @@ -2215,48 +2071,17 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| SEL linkSelector = |
| (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? |
| @selector(showAccountManagement:) : @selector(hideAccountManagement:); |
| - if (switches::IsMaterialDesignUserMenu()) { |
| - rect.size.width += |
| - kRightPadding; // Spans the width of the entire menu. |
| - link = [self hoverButtonWithRect:NSMakeRect(0, 0, rect.size.width, |
| - kBlueButtonHeight) |
| - text:linkTitle |
| - action:linkSelector]; |
| - } else { |
| - link = [self linkButtonWithTitle:linkTitle |
| - frameOrigin:rect.origin |
| - action:linkSelector]; |
| - } |
| - } else if (!switches::IsMaterialDesignUserMenu()) { |
| - link = [self linkButtonWithTitle:base::SysUTF16ToNSString(item.username) |
| - frameOrigin:rect.origin |
| - action:nil]; |
| - if (HasAuthError(browser_->profile())) { |
| - [link setImage:ui::ResourceBundle::GetSharedInstance(). |
| - GetNativeImageNamed(IDR_ICON_PROFILES_ACCOUNT_BUTTON_ERROR). |
| - ToNSImage()]; |
| - [link setImagePosition:NSImageRight]; |
| - [link setTarget:self]; |
| - [link setAction:@selector(showAccountReauthenticationView:)]; |
| - [link setTag:kPrimaryProfileTag]; |
| - [[link cell] |
| - accessibilitySetOverrideValue:l10n_util::GetNSStringF( |
| - IDS_PROFILES_ACCOUNT_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME, |
| - item.username) |
| - forAttribute:NSAccessibilityTitleAttribute]; |
| - } else { |
| - // Signed in profiles with no authentication errors do not have a |
| - // clickable email link. |
| - [link setEnabled:NO]; |
| - } |
| + rect.size.width += kRightPadding; // Spans the width of the entire menu. |
| + link = [self hoverButtonWithRect:NSMakeRect(0, 0, rect.size.width, |
| + kBlueButtonHeight) |
| + text:linkTitle |
| + action:linkSelector]; |
| } |
| if (link) { |
| // -linkButtonWithTitle sizeToFit's the link. We can use the height, but |
| // need to re-stretch the width so that the link can be centered correctly |
| // in the view. |
| rect.size.height = [link frame].size.height; |
| - if (!switches::IsMaterialDesignUserMenu()) |
| - [link setAlignment:NSCenterTextAlignment]; |
| [link setFrame:rect]; |
| [container addSubview:link]; |
| [container setFrameSize:rect.size]; |
| @@ -2275,8 +2100,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| gfx::FontList(), rect.size.width, gfx::ELIDE_TAIL)); |
| [signinButton setTitle:elidedButtonText]; |
| - if (switches::IsMaterialDesignUserMenu()) |
| - [signinButton sizeToFit]; |
| + [signinButton sizeToFit]; |
| [signinButton setTarget:self]; |
| [signinButton setAction:@selector(showInlineSigninPage:)]; |
| [container addSubview:signinButton]; |
| @@ -2293,12 +2117,9 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:promo]; |
| [container addSubview:promo]; |
| - [container |
| - setFrameSize:NSMakeSize(rect.size.width, |
| - NSMaxY([promo frame]) + |
| - (switches::IsMaterialDesignUserMenu() |
| - ? kRelatedControllVerticalSpacing |
| - : 4))]; |
| + [container setFrameSize:NSMakeSize(rect.size.width, |
| + NSMaxY([promo frame]) + |
| + kRelatedControllVerticalSpacing)]; |
| content::RecordAction( |
| base::UserMetricsAction("Signin_Impression_FromAvatarBubbleSignin")); |
| } |
| @@ -2336,9 +2157,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| guestItem.name = base::SysNSStringToUTF16( |
| l10n_util::GetNSString(IDS_PROFILES_GUEST_PROFILE_NAME)); |
| - return switches::IsMaterialDesignUserMenu() |
| - ? [self createMaterialDesignCurrentProfileView:guestItem] |
| - : [self createCurrentProfileView:guestItem]; |
| + return [self createMaterialDesignCurrentProfileView:guestItem]; |
| } |
| - (NSButton*)createOtherProfileView:(int)itemIndex { |
| @@ -2346,38 +2165,24 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| NSRect rect = NSMakeRect(0, 0, GetFixedMenuWidth(), |
| kBlueButtonHeight + kSmallVerticalSpacing); |
| - const int imageTitleSpacing = switches::IsMaterialDesignUserMenu() |
| - ? kHorizontalSpacing |
| - : kImageTitleSpacing; |
| + const int imageTitleSpacing = kHorizontalSpacing; |
| base::scoped_nsobject<BackgroundColorHoverButton> profileButton( |
| [[BackgroundColorHoverButton alloc] |
| initWithFrame:rect |
| imageTitleSpacing:imageTitleSpacing |
| backgroundColor:GetDialogBackgroundColor()]); |
| - if (switches::IsMaterialDesignUserMenu()) |
| - [profileButton setRightMarginSpacing:kHorizontalSpacing]; |
| + [profileButton setRightMarginSpacing:kHorizontalSpacing]; |
| NSString* title = base::SysUTF16ToNSString( |
| profiles::GetProfileSwitcherTextForItem(item)); |
| [profileButton setTitle:title]; |
| CGFloat availableWidth; |
| - if (switches::IsMaterialDesignUserMenu()) { |
| - int iconImageSide = 18; |
| - [profileButton setDefaultImage:CreateProfileImage(item.icon, iconImageSide, |
| - profiles::SHAPE_CIRCLE)]; |
| - availableWidth = rect.size.width - iconImageSide - imageTitleSpacing - |
| - 2 * kHorizontalSpacing; |
| - } else { |
| - // Use the low-res, small default avatars in the fast user switcher, like |
| - // we do in the menu bar. |
| - gfx::Image itemIcon; |
| - AvatarMenu::GetImageForMenuButton(item.profile_path, &itemIcon); |
| - [profileButton setDefaultImage:CreateProfileImage(itemIcon, kSmallImageSide, |
| - profiles::SHAPE_SQUARE)]; |
| - availableWidth = rect.size.width - kSmallImageSide - imageTitleSpacing - |
| - kHorizontalSpacing; |
| - } |
| + int iconImageSide = 18; |
|
msarda
2017/02/23 11:51:02
Optional nit: Let's make this a constant:
const in
jlebel
2017/02/23 18:18:49
Done.
|
| + [profileButton setDefaultImage:CreateProfileImage(item.icon, iconImageSide, |
| + profiles::SHAPE_CIRCLE)]; |
| + availableWidth = rect.size.width - iconImageSide - imageTitleSpacing - |
| + 2 * kHorizontalSpacing; |
| [profileButton setImagePosition:NSImageLeft]; |
| [profileButton setAlignment:NSLeftTextAlignment]; |
| @@ -2386,70 +2191,9 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| [profileButton setTarget:self]; |
| [profileButton setAction:@selector(switchToProfile:)]; |
| - NSSize textSize = [[profileButton title] sizeWithAttributes:@{ |
| - NSFontAttributeName : [profileButton font] |
| - }]; |
| - |
| - if (!switches::IsMaterialDesignUserMenu() && |
| - std::ceil(textSize.width) > availableWidth) |
| - [profileButton setToolTip:[profileButton title]]; |
| - |
| return profileButton.autorelease(); |
| } |
| -- (NSView*)createOptionsViewWithRect:(NSRect)rect |
| - showLock:(BOOL)showLock { |
| - NSRect viewRect = NSMakeRect(0, 0, |
| - rect.size.width, |
| - kBlueButtonHeight + kSmallVerticalSpacing); |
| - base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
| - |
| - if (showLock) { |
| - NSButton* lockButton = |
| - [self hoverButtonWithRect:viewRect |
| - text:l10n_util::GetNSString( |
| - IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) |
| - imageResourceId:IDR_ICON_PROFILES_MENU_LOCK |
| - action:@selector(lockProfile:)]; |
| - [container addSubview:lockButton]; |
| - viewRect.origin.y = NSMaxY([lockButton frame]); |
| - |
| - NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; |
| - [container addSubview:separator]; |
| - viewRect.origin.y = NSMaxY([separator frame]); |
| - } |
| - |
| - if ([self shouldShowGoIncognito]) { |
| - NSButton* goIncognitoButton = |
| - [self hoverButtonWithRect:viewRect |
| - text:l10n_util::GetNSString( |
| - IDS_PROFILES_GO_INCOGNITO_BUTTON) |
| - imageResourceId:IDR_ICON_PROFILES_MENU_INCOGNITO |
| - action:@selector(goIncognito:)]; |
| - viewRect.origin.y = NSMaxY([goIncognitoButton frame]); |
| - [container addSubview:goIncognitoButton]; |
| - |
| - NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; |
| - [container addSubview:separator]; |
| - viewRect.origin.y = NSMaxY([separator frame]); |
| - } |
| - |
| - NSString* text = isGuestSession_ ? |
| - l10n_util::GetNSString(IDS_PROFILES_EXIT_GUEST) : |
| - l10n_util::GetNSString(IDS_PROFILES_SWITCH_USERS_BUTTON); |
| - NSButton* switchUsersButton = |
| - [self hoverButtonWithRect:viewRect |
| - text:text |
| - imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR |
| - action:isGuestSession_? @selector(exitGuest:) : |
| - @selector(showUserManager:)]; |
| - viewRect.origin.y = NSMaxY([switchUsersButton frame]); |
| - [container addSubview:switchUsersButton]; |
| - |
| - [container setFrameSize:NSMakeSize(rect.size.width, viewRect.origin.y)]; |
| - return container.autorelease(); |
| -} |
| - |
| - (NSView*)createCurrentProfileAccountsView:(NSRect)rect { |
| const CGFloat kAccountButtonHeight = 34; |
| @@ -2851,9 +2595,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| base::scoped_nsobject<BackgroundColorHoverButton> button( |
| [[BackgroundColorHoverButton alloc] |
| initWithFrame:rect |
| - imageTitleSpacing:switches::IsMaterialDesignUserMenu() |
| - ? md_image_title_spacing |
| - : kImageTitleSpacing |
| + imageTitleSpacing:md_image_title_spacing |
| backgroundColor:GetDialogBackgroundColor()]); |
| [button setTitle:text]; |