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

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

Issue 493113002: [Win, Profiles] Changing your default avatar should not change your default name (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
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/new_avatar_button.h » ('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 8552cdf606c84819aab06963619d0a3551381ae0..58096acdc6d5691954120bc54d2562fbcce75f3d 100644
--- a/chrome/browser/profiles/profiles_state.cc
+++ b/chrome/browser/profiles/profiles_state.cc
@@ -93,15 +93,19 @@ 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();
+ size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath());
+ if (profile_index == std::string::npos)
+ return;
Roger Tawa OOO till Jul 10th 2014/08/21 18:32:31 Should this be a DCHECK?
noms (inactive) 2014/08/21 18:36:18 Ugh, everything is peppered with this kind of chec
+
+ if (new_profile_name == cache.GetNameOfProfileAtIndex(profile_index))
+ return;
// 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);
+ PrefService* pref_service = profile->GetPrefs();
+ pref_service->SetBoolean(prefs::kProfileUsingDefaultName, false);
// Updating the profile preference will cause the cache to be updated for
// this preference.
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/new_avatar_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698