Index: chrome/browser/profiles/profiles_state.cc |
diff --git a/chrome/browser/profiles/profiles_state.cc b/chrome/browser/profiles/profiles_state.cc |
index 282ffd3f3544b25312ce4518a7be51cf4b0faacf..2ce7489880a4a80f381e1ef450871a69355d166a 100644 |
--- a/chrome/browser/profiles/profiles_state.cc |
+++ b/chrome/browser/profiles/profiles_state.cc |
@@ -10,6 +10,8 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_avatar_downloader.h" |
+#include "chrome/browser/profiles/profile_avatar_icon_util.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
@@ -113,4 +115,22 @@ bool IsRegularOrGuestSession(Browser* browser) { |
return profile->IsGuestSession() || !profile->IsOffTheRecord(); |
} |
+void DownloadHighResAvatarIfNeeded(size_t icon_index) { |
+ // TODO(noms): We should check whether the file already exists on disk |
+ // before trying to re-download it. For now, since this is behind a flag and |
+ // the resources are still changing, re-download it every time the profile |
+ // avatar changes, to make sure we have the latest copy. |
+ ProfileInfoCache* cache = |
+ &g_browser_process->profile_manager()->GetProfileInfoCache(); |
+ |
+ // Start the download for this file. The cache takes ownership of the |
+ // |avatar_downloader|, which will be deleted when the download completes, or |
+ // if that never happens, when the ProfileInfoCache is destroyed. |
+ ProfileAvatarDownloader* avatar_dowloader = new ProfileAvatarDownloader( |
+ g_browser_process->system_request_context(), |
+ icon_index, |
+ cache); |
+ cache->DownloadHighResAvatar(avatar_dowloader, icon_index); |
+} |
+ |
} // namespace profiles |