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

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

Issue 974373002: [Profiles] Notify observers if a profile switches bw/ default and custom names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar better code Created 5 years, 9 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 3e7c05c3c2a4f4bd141d3e47e2ed662488ec0af5..0b01f095c8991206cf6b8a72effde167cbbb4038 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -739,11 +739,22 @@ void ProfileInfoCache::SetProfileIsUsingDefaultNameAtIndex(
if (value == ProfileIsUsingDefaultNameAtIndex(index))
return;
+ base::string16 old_display_name = GetNameOfProfileAtIndex(index);
+
scoped_ptr<base::DictionaryValue> info(
GetInfoForProfileAtIndex(index)->DeepCopy());
info->SetBoolean(kIsUsingDefaultNameKey, value);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
+
+ base::string16 new_display_name = GetNameOfProfileAtIndex(index);
+ const base::FilePath profile_path = GetPathOfProfileAtIndex(index);
+
+ if (old_display_name != new_display_name) {
+ FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
+ observer_list_,
+ OnProfileNameChanged(profile_path, old_display_name));
+ }
}
void ProfileInfoCache::SetProfileIsUsingDefaultAvatarAtIndex(
« 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