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

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 287103004: New avatar menu: For supervised users, show "(Supervised)" in the avatar button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New mocks Created 6 years, 7 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698