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

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

Issue 8894005: Ensure that use of GAIA names are considered when handling desktop shortcut changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: beefed comment Created 9 years 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/profile_info_cache.cc
===================================================================
--- chrome/browser/profiles/profile_info_cache.cc (revision 114091)
+++ chrome/browser/profiles/profile_info_cache.cc (working copy)
@@ -229,19 +229,16 @@
}
void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) {
- DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
- DictionaryValue* cache = update.Get();
+ string16 name = GetNameOfProfileAtIndex(
+ GetIndexOfProfileWithPath(profile_path));
- std::string key = CacheKeyFromProfilePath(profile_path);
- DictionaryValue* info = NULL;
- cache->GetDictionary(key, &info);
- string16 name;
- info->GetString(kNameKey, &name);
-
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
observer_list_,
OnProfileRemoved(name));
+ DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
+ DictionaryValue* cache = update.Get();
+ std::string key = CacheKeyFromProfilePath(profile_path);
cache->Remove(key, NULL);
sorted_keys_.erase(std::find(sorted_keys_.begin(), sorted_keys_.end(), key));
@@ -404,8 +401,7 @@
return;
scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy());
- string16 old_name;
- info->GetString(kNameKey, &old_name);
+ string16 old_name = GetNameOfProfileAtIndex(index);
info->SetString(kNameKey, name);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
@@ -430,12 +426,11 @@
void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index,
size_t icon_index) {
scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy());
- string16 name;
- info->GetString(kNameKey, &name);
info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index));
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
+ string16 name = GetNameOfProfileAtIndex(index);
FilePath profile_path = GetPathOfProfileAtIndex(index);
std::string key = CacheKeyFromProfilePath(profile_path);
gfx::Image& avatar_img =
@@ -477,10 +472,19 @@
return;
scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy());
+ string16 old_name;
+ info->GetString(kNameKey, &old_name);
info->SetBoolean(kUseGAIANameKey, value);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
+ string16 new_name = GetGAIANameOfProfileAtIndex(index);
UpdateSortForProfileIndex(index);
+
+ if (value) {
+ FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
+ observer_list_,
+ OnProfileNameChanged(old_name, new_name));
+ }
}
void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index,
@@ -534,8 +538,7 @@
void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index,
bool value) {
scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy());
- string16 name;
- info->GetString(kNameKey, &name);
+ string16 name = GetNameOfProfileAtIndex(index);
info->SetBoolean(kUseGAIAPictureKey, value);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
« no previous file with comments | « chrome/browser/profiles/gaia_info_update_service.cc ('k') | chrome/browser/profiles/profile_info_cache_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698