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

Unified Diff: chrome/browser/profiles/profiles_state.cc

Issue 381953002: New avatar button: Consolidate text elision between Mac and Win/Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use gfx::BreakType Created 6 years, 5 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/profiles/profiles_state.cc
diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc
index de95755b0e49b796d67dac8b0e3bba556636f33f..e8bb677b14d1e9066b543fbd4eb0038628547a78 100644
--- a/chrome/browser/profiles/profiles_state.cc
+++ b/chrome/browser/profiles/profiles_state.cc
@@ -22,6 +22,7 @@
#include "components/signin/core/common/profile_management_switches.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/text_elider.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/user_manager.h"
@@ -81,6 +82,18 @@ base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
return display_name;
}
+base::string16 GetAvatarButtonTextForProfile(Profile* profile) {
+ const int kMaxCharactersToDisplay = 15;
+ base::string16 name = GetAvatarNameForProfile(profile->GetPath());
+ name = gfx::TruncateString(name,
+ kMaxCharactersToDisplay,
+ gfx::CHARACTER_BREAK);
+ 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();

Powered by Google App Engine
This is Rietveld 408576698