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 239255a6cba156328d3ef3030d24ca5ba8292653..a9993117e8417c5190b1efc2f1cb7afd9c866dc3 100644 |
| --- a/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| +++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| @@ -54,6 +54,20 @@ base::string16 GetElidedText(const base::string16& original_text) { |
| gfx::ELIDE_AT_END); |
| } |
| +base::string16 GetButtonText(Profile* profile) { |
| + base::string16 name = GetElidedText( |
| + profiles::GetAvatarNameForProfile(profile)); |
| + if (profile->IsManaged()) { |
| + base::string16 label( |
| + l10n_util::GetStringUTF16(IDS_MANAGED_USER_NEW_AVATAR_LABEL)); |
| + if (base::i18n::IsRTL()) |
| + name = label + base::char16(' ') + name; |
|
msw
2014/05/21 17:20:25
Appending the strings like this is incorrect, even
Marc Treib
2014/05/26 09:17:53
Ah yes, I was kinda expecting a comment here ;-)
S
|
| + else |
| + name = name + base::char16(' ') + label; |
| + } |
| + return name; |
| +} |
| + |
| } // namespace |
| NewAvatarButton::NewAvatarButton( |
| @@ -61,7 +75,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), |
|
Marc Treib
2014/05/21 16:19:55
@noms: Is there any reason why this didn't use pro
noms (inactive)
2014/05/21 17:00:57
None that I can see. I think GetAvatarNameForProfi
|
| browser_(browser) { |
| set_animate_on_state_change(false); |
| @@ -151,8 +165,7 @@ void NewAvatarButton::OnProfileNameChanged( |
| void NewAvatarButton::UpdateAvatarButtonAndRelayoutParent() { |
| // We want the button to resize if the new text is shorter. |
| ClearMaxTextSize(); |
| - SetText(GetElidedText( |
| - profiles::GetAvatarNameForProfile(browser_->profile()))); |
| + SetText(GetButtonText(browser_->profile())); |
| // Because the width of the button might have changed, the parent browser |
| // frame needs to recalculate the button bounds and redraw it. |