Index: chrome/browser/profiles/profiles_state.cc |
diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc |
index 827c9c979d6c3650a619faeb42af996e79301fa8..5095c1f03a61718a266230ab7e9a2725e3b6e193 100644 |
--- a/chrome/browser/profiles/profiles_state.cc |
+++ b/chrome/browser/profiles/profiles_state.cc |
@@ -98,6 +98,17 @@ base::string16 GetAvatarButtonTextForProfile(Profile* profile) { |
void UpdateProfileName(Profile* profile, |
const base::string16& new_profile_name) { |
PrefService* pref_service = profile->GetPrefs(); |
+ ProfileInfoCache& cache = |
+ g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ |
+ // Check whether the user has specifically chosen to use a default profile |
+ // name. |
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
+ if (profile_index != std::string::npos) { |
+ pref_service->SetInteger(prefs::kProfileUsingDefaultName, |
+ cache.IsDefaultProfileName(new_profile_name) ? 1 : 0); |
+ } |
+ |
// Updating the profile preference will cause the cache to be updated for |
// this preference. |
pref_service->SetString(prefs::kProfileName, |