| Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
|
| index 16f070355c5c0832d36fe6c5f7946eff9577caec..e7ec7476639cbe2ffd64167a35704938b70137f2 100644
|
| --- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
|
| @@ -30,7 +30,6 @@ const CGFloat kButtonPadding = 12;
|
| const CGFloat kButtonDefaultPadding = 5;
|
| const CGFloat kButtonHeight = 27;
|
| const CGFloat kButtonTitleImageSpacing = 10;
|
| -const CGFloat kMaxButtonContentWidth = 100;
|
|
|
| const ui::NinePartImageIds kNormalBorderImageIds =
|
| IMAGE_GRID(IDR_AVATAR_MAC_BUTTON_NORMAL);
|
| @@ -221,12 +220,11 @@ NSImage* GetImageFromResourceID(int resourceId) {
|
| }
|
| }
|
|
|
| -- (base::string16)getElidedAvatarName {
|
| - base::string16 name = profiles::GetAvatarNameForProfile(
|
| - browser_->profile()->GetPath());
|
| - int maxTextWidth = kMaxButtonContentWidth - [[button_ image] size].width;
|
| - return gfx::ElideText(name, gfx::FontList(gfx::Font([button_ font])),
|
| - maxTextWidth, gfx::ELIDE_TAIL);
|
| +- (NSString*)getButtonText {
|
| + const gfx::FontList font_list = gfx::FontList(gfx::Font([button_ font]));
|
| + base::string16 name =
|
| + profiles::GetAvatarButtonTextForProfile(browser_->profile(), font_list);
|
| + return base::SysUTF16ToNSString(name);
|
| }
|
|
|
| - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {
|
| @@ -249,16 +247,7 @@ NSImage* GetImageFromResourceID(int resourceId) {
|
| [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]];
|
| }
|
|
|
| - base::string16 profileName = [self getElidedAvatarName];
|
| - NSString* buttonTitle = nil;
|
| - if (browser_->profile()->IsSupervised()) {
|
| - // Add the "supervised" label after eliding the profile name, so the label
|
| - // will not get elided, but will instead enlarge the button.
|
| - buttonTitle = l10n_util::GetNSStringF(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL,
|
| - profileName);
|
| - } else {
|
| - buttonTitle = base::SysUTF16ToNSString(profileName);
|
| - }
|
| + NSString* buttonTitle = [self getButtonText];
|
|
|
| base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle(
|
| [[NSMutableParagraphStyle alloc] init]);
|
|
|