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

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

Issue 476993002: [Profiles] Fix the usage of custom/default names and avatars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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,

Powered by Google App Engine
This is Rietveld 408576698