Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/new_avatar_button.cc |
| diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| index ec28c46d12f6bfd6ecc1366fa9ca58afb44a29c7..4d4771a65bde6904d0526ad83939970be222f0cc 100644 |
| --- a/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| +++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| @@ -56,6 +56,14 @@ base::string16 GetElidedText(const base::string16& original_text) { |
| gfx::ELIDE_AT_END); |
| } |
| +base::string16 GetButtonText(Profile* profile) { |
|
msw
2014/05/27 17:16:41
nit: could this and GetElidedText be shared cross-
Marc Treib
2014/05/28 11:04:05
At the moment, the GetElidedText implementations b
msw
2014/05/28 20:13:24
You can land as-is and cleanup later if needed.
Co
|
| + base::string16 name = GetElidedText( |
| + profiles::GetAvatarNameForProfile(profile)); |
| + if (profile->IsManaged()) |
| + name = l10n_util::GetStringFUTF16(IDS_MANAGED_USER_NEW_AVATAR_LABEL, name); |
| + return name; |
| +} |
| + |
| } // namespace |
| NewAvatarButton::NewAvatarButton( |
| @@ -63,7 +71,7 @@ NewAvatarButton::NewAvatarButton( |
| const base::string16& profile_name, |
| AvatarButtonStyle button_style, |
| Browser* browser) |
| - : MenuButton(listener, GetElidedText(profile_name), NULL, true), |
| + : MenuButton(listener, GetButtonText(browser->profile()), NULL, true), |
| browser_(browser) { |
| set_animate_on_state_change(false); |
| set_icon_placement(ICON_ON_RIGHT); |
| @@ -173,8 +181,7 @@ void NewAvatarButton::OnErrorChanged() { |
| void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() { |
| // We want the button to resize if the new text is shorter. |
| - SetText(GetElidedText( |
| - profiles::GetAvatarNameForProfile(browser_->profile()))); |
| + SetText(GetButtonText(browser_->profile())); |
| ClearMaxTextSize(); |
| // Because the width of the button might have changed, the parent browser |