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

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

Issue 504453002: Use 'You' as profile name for a single signed profile whose gaia name is not available yet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix broken tests Created 6 years, 4 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/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/ui/cocoa/cocoa_profile_test.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profiles_state.cc
diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc
index de8193d98e024e547e8810c111f64b411ef1ecf0..03fa429d80955faee1955633cabad9595b3f34c4 100644
--- a/chrome/browser/profiles/profiles_state.cc
+++ b/chrome/browser/profiles/profiles_state.cc
@@ -59,21 +59,19 @@ base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
if (index == std::string::npos)
return l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
- // Using the --new-profile-management flag, there's a couple of rules
- // about what the avatar button displays. If there's a single, local
- // profile, with a default name (i.e. of the form Person %d), it should
- // display IDS_SINGLE_PROFILE_DISPLAY_NAME. If this is a signed in profile,
- // or the user has edited the profile name, or there are multiple profiles,
- // it will return the actual name of the profile.
+ // Using the --new-avatar-menu flag, there's a couple of rules about what
+ // the avatar button displays. If there's a single profile, with a default
+ // name (i.e. of the form Person %d) not manually set, it should display
+ // IDS_SINGLE_PROFILE_DISPLAY_NAME. Otherwise, it will return the actual
+ // name of the profile.
base::string16 profile_name = cache.GetNameOfProfileAtIndex(index);
- bool has_default_name = cache.ProfileIsUsingDefaultNameAtIndex(index);
+ bool has_default_name = cache.ProfileIsUsingDefaultNameAtIndex(index) &&
+ cache.IsDefaultProfileName(profile_name);
- if (cache.GetNumberOfProfiles() == 1 && has_default_name &&
- cache.GetUserNameOfProfileAtIndex(index).empty()) {
+ if (cache.GetNumberOfProfiles() == 1 && has_default_name)
display_name = l10n_util::GetStringUTF16(IDS_SINGLE_PROFILE_DISPLAY_NAME);
- } else {
+ else
display_name = profile_name;
- }
}
return display_name;
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/ui/cocoa/cocoa_profile_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698