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

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: all rebase all the time 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 c19fb3320552689b4db4b94df019485d30d535b0..8552cdf606c84819aab06963619d0a3551381ae0 100644
--- a/chrome/browser/profiles/profiles_state.cc
+++ b/chrome/browser/profiles/profiles_state.cc
@@ -94,6 +94,15 @@ 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();
+
+ // This is only called when updating the profile name through the UI,
+ // so we can assume the user has done this on purpose.
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
+ if (profile_index != std::string::npos)
+ pref_service->SetBoolean(prefs::kProfileUsingDefaultName, false);
+
// Updating the profile preference will cause the cache to be updated for
// this preference.
pref_service->SetString(prefs::kProfileName,
« no previous file with comments | « chrome/browser/profiles/profiles_state.h ('k') | chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698