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

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

Issue 1127113003: Don't try to download 'NothingToDownload' placeholder avatar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 5 years, 7 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
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(

Powered by Google App Engine
This is Rietveld 408576698