Chromium Code Reviews| Index: chrome/browser/profiles/profile_info_cache.cc |
| =================================================================== |
| --- chrome/browser/profiles/profile_info_cache.cc (revision 112717) |
| +++ chrome/browser/profiles/profile_info_cache.cc (working copy) |
| @@ -205,9 +205,13 @@ |
| sorted_keys_.insert(FindPositionForProfile(key, name), key); |
| + gfx::Image& avatar_img = ResourceBundle::GetSharedInstance().GetImageNamed( |
|
Robert Sesek
2011/12/05 18:03:28
GetNativeImageNamed()
SteveT
2011/12/05 20:33:17
Done.
|
| + GetDefaultAvatarIconResourceIDAtIndex(icon_index)); |
| + |
| FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| observer_list_, |
| - OnProfileAdded(name, UTF8ToUTF16(key))); |
| + OnProfileAdded(name, UTF8ToUTF16(key), |
| + profile_path, &avatar_img)); |
| content::NotificationService::current()->Notify( |
| chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
| @@ -425,9 +429,21 @@ |
| 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()); |
| + |
| + FilePath profile_path = GetPathOfProfileAtIndex(index); |
| + std::string key = CacheKeyFromProfilePath(profile_path); |
| + gfx::Image& avatar_img = ResourceBundle::GetSharedInstance().GetImageNamed( |
|
Robert Sesek
2011/12/05 18:03:28
here too
SteveT
2011/12/05 20:33:17
Done.
|
| + GetDefaultAvatarIconResourceIDAtIndex(icon_index)); |
| + |
| + FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| + observer_list_, |
| + OnProfileAvatarChanged(name, UTF8ToUTF16(key), |
| + profile_path, &avatar_img)); |
| } |
| void ProfileInfoCache::SetBackgroundStatusOfProfileAtIndex( |
| @@ -516,9 +532,23 @@ |
| void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, |
| bool value) { |
| scoped_ptr<DictionaryValue> info(GetInfoForProfileAtIndex(index)->DeepCopy()); |
| + string16 name; |
| + info->GetString(kNameKey, &name); |
| info->SetBoolean(kUseGAIAPictureKey, value); |
| // This takes ownership of |info|. |
| SetInfoForProfileAtIndex(index, info.release()); |
| + |
| + // Retrieve some info to update observers who care about avatar changes. |
| + if (value) { |
| + FilePath profile_path = GetPathOfProfileAtIndex(index); |
| + std::string key = CacheKeyFromProfilePath(profile_path); |
| + |
| + FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| + observer_list_, |
| + OnProfileAvatarChanged(name, UTF8ToUTF16(key), |
| + profile_path, |
| + gaia_pictures_[key])); |
| + } |
| } |
| string16 ProfileInfoCache::ChooseNameForNewProfile(size_t icon_index) { |