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

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: Add Mac implementation 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
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

Powered by Google App Engine
This is Rietveld 408576698