Chromium Code Reviews| 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 b83881a561093bbac9f629c7546ac0acaa6f8e82..a04d29a2d4e3774940d207bdbc0cd0e2cf604d7a 100644 |
| --- a/chrome/browser/profiles/profile_info_cache.cc |
| +++ b/chrome/browser/profiles/profile_info_cache.cc |
| @@ -905,6 +905,11 @@ void ProfileInfoCache::DownloadHighResAvatarIfNeeded( |
| #endif |
| DCHECK(!disable_avatar_download_for_testing_); |
| + // If this is the placeholder avatar, it is already included in the |
| + // resources, so it doesn't need to be downloaded. |
|
Mike Lerman
2015/05/13 20:53:59
Can you append:
The avatar picture for this index
|
| + if (icon_index == profiles::GetPlaceholderAvatarIndex()) |
| + return; |
| + |
| const base::FilePath& file_path = |
| profiles::GetPathOfHighResAvatarAtIndex(icon_index); |
| base::Closure callback = |
| @@ -1036,20 +1041,21 @@ void ProfileInfoCache::UpdateSortForProfileIndex(size_t index) { |
| const gfx::Image* ProfileInfoCache::GetHighResAvatarOfProfileAtIndex( |
| size_t index) const { |
| - int avatar_index = GetAvatarIconIndexOfProfileAtIndex(index); |
| - std::string key = profiles::GetDefaultAvatarIconFileNameAtIndex(avatar_index); |
| + const size_t avatar_index = GetAvatarIconIndexOfProfileAtIndex(index); |
| // If this is the placeholder avatar, it is already included in the |
| // resources, so it doesn't need to be downloaded. |
| - if (!strcmp(key.c_str(), profiles::GetNoHighResAvatarFileName())) { |
| + if (avatar_index == profiles::GetPlaceholderAvatarIndex()) { |
| return &ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| profiles::GetPlaceholderAvatarIconResourceID()); |
| } |
| - base::FilePath image_path = |
| + const std::string file_name = |
| + profiles::GetDefaultAvatarIconFileNameAtIndex(avatar_index); |
| + const base::FilePath image_path = |
| profiles::GetPathOfHighResAvatarAtIndex(avatar_index); |
| - return LoadAvatarPictureFromPath(GetPathOfProfileAtIndex(index), |
| - key, image_path); |
| + return LoadAvatarPictureFromPath(GetPathOfProfileAtIndex(index), file_name, |
| + image_path); |
| } |
| void ProfileInfoCache::DownloadHighResAvatar( |