Chromium Code Reviews| 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. |