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

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

Issue 9020013: Refactor ProfileInfoCacheObserver interface and usage thereof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: init 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 115334)
+++ chrome/browser/profiles/profile_info_cache.cc (working copy)
@@ -206,14 +206,9 @@
sorted_keys_.insert(FindPositionForProfile(key, name), key);
- gfx::Image& avatar_img =
- ResourceBundle::GetSharedInstance().GetNativeImageNamed(
- GetDefaultAvatarIconResourceIDAtIndex(icon_index));
-
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
observer_list_,
- OnProfileAdded(name, UTF8ToUTF16(key),
- profile_path, &avatar_img));
+ OnProfileAdded(profile_path, UTF8ToUTF16(key)));
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
@@ -441,17 +436,12 @@
// 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 =
- ResourceBundle::GetSharedInstance().GetNativeImageNamed(
- GetDefaultAvatarIconResourceIDAtIndex(icon_index));
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
observer_list_,
- OnProfileAvatarChanged(name, UTF8ToUTF16(key),
- profile_path, &avatar_img));
+ OnProfileAvatarChanged(profile_path, UTF8ToUTF16(key)));
}
void ProfileInfoCache::SetBackgroundStatusOfProfileAtIndex(
@@ -552,18 +542,14 @@
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
- string16 name = GetNameOfProfileAtIndex(index);
- const gfx::Image& avatar_image = GetAvatarIconOfProfileAtIndex(index);
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
observer_list_,
- OnProfileAvatarChanged(name, UTF8ToUTF16(key),
- path, &avatar_image));
+ OnProfileAvatarChanged(path, UTF8ToUTF16(key)));
}
void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index,
bool value) {
scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy());
- string16 name = GetNameOfProfileAtIndex(index);
info->SetBoolean(kUseGAIAPictureKey, value);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
@@ -572,13 +558,9 @@
if (value) {
FilePath profile_path = GetPathOfProfileAtIndex(index);
std::string key = CacheKeyFromProfilePath(profile_path);
- if (gaia_pictures_.find(key) != gaia_pictures_.end()) {
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAvatarChanged(name, UTF8ToUTF16(key),
- profile_path,
- gaia_pictures_[key]));
- }
+ FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
+ observer_list_,
+ OnProfileAvatarChanged(profile_path, UTF8ToUTF16(key)));
}
}

Powered by Google App Engine
This is Rietveld 408576698