Chromium Code Reviews| Index: chrome/browser/profiles/profiles_state.cc |
| diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc |
| index de95755b0e49b796d67dac8b0e3bba556636f33f..13c6c08571dbb7ee1de0b6d6203dfe5e9b6a493c 100644 |
| --- a/chrome/browser/profiles/profiles_state.cc |
| +++ b/chrome/browser/profiles/profiles_state.cc |
| @@ -22,6 +22,8 @@ |
| #include "components/signin/core/common/profile_management_switches.h" |
| #include "grit/generated_resources.h" |
| #include "ui/base/l10n/l10n_util.h" |
| +#include "ui/gfx/font_list.h" |
| +#include "ui/gfx/text_elider.h" |
| #if defined(OS_CHROMEOS) |
| #include "chrome/browser/chromeos/login/users/user_manager.h" |
| @@ -81,6 +83,20 @@ base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) { |
| return display_name; |
| } |
| +base::string16 GetAvatarButtonTextForProfile(Profile* profile, |
| + const gfx::FontList& font_list) { |
| + const int kMaxCharactersToDisplay = 15; |
|
noms (inactive)
2014/07/11 13:21:57
I think msw had suggested we use a max size, and n
msw
2014/07/11 22:17:06
My goal is to remove the explicit call to ElideTex
|
| + base::string16 name = GetAvatarNameForProfile(profile->GetPath()); |
| + name = gfx::ElideText(name, |
| + font_list, |
| + font_list.GetExpectedTextWidth(kMaxCharactersToDisplay), |
|
msw
2014/07/16 16:58:28
Could you use gfx::TruncateString instead, since y
Marc Treib
2014/07/17 08:43:00
Well, that depends on what exactly the intended be
|
| + gfx::ELIDE_TAIL); |
| + if (profile->IsSupervised()) |
| + name = l10n_util::GetStringFUTF16(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL, |
| + name); |
| + return name; |
| +} |
| + |
| void UpdateProfileName(Profile* profile, |
| const base::string16& new_profile_name) { |
| PrefService* pref_service = profile->GetPrefs(); |