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

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

Issue 373093002: ProfileInfoCache: Notify observers of a name change on SetGAIAGivenNameOfProfileAtIndex. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache.cc
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index a6f8d9abb02caa453cd2642ea2aa49105abb51bc..c0c013b15a241c393b0543450e41437f4f5ab7f3 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -611,11 +611,21 @@ void ProfileInfoCache::SetGAIAGivenNameOfProfileAtIndex(
if (name == GetGAIAGivenNameOfProfileAtIndex(index))
return;
+ base::string16 old_display_name = GetNameOfProfileAtIndex(index);
scoped_ptr<base::DictionaryValue> info(
GetInfoForProfileAtIndex(index)->DeepCopy());
info->SetString(kGAIAGivenNameKey, name);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
+ base::string16 new_display_name = GetNameOfProfileAtIndex(index);
+ base::FilePath profile_path = GetPathOfProfileAtIndex(index);
+ UpdateSortForProfileIndex(index);
+
+ if (old_display_name != new_display_name) {
+ FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
+ observer_list_,
+ OnProfileNameChanged(profile_path, old_display_name));
+ }
}
void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698