Chromium Code Reviews| 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 |
|
msw
2014/04/28 20:46:37
This seems like a fairly straightforward duty of P
noms (inactive)
2014/04/29 19:12:27
We'd like to test it for a bit, given that it's su
|
| + // 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 |
|
msw
2014/04/28 20:46:37
What is the plan going forward if the resources ch
noms (inactive)
2014/04/29 19:12:27
I don't think we plan to do any versioning. The id
|
| + // 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( |
|
msw
2014/04/28 20:46:37
Is this object leaked if DownloadHighResAvatar ret
noms (inactive)
2014/04/29 19:12:27
Ah yes, this is much better. This didn't work befo
|
| + g_browser_process->system_request_context(), |
|
msw
2014/04/28 20:46:37
Can't ProfileAvatarDownloader obtain this value in
noms (inactive)
2014/04/29 19:12:27
Done.
|
| + icon_index, |
| + cache); |
| + cache->DownloadHighResAvatar(avatar_dowloader, icon_index); |
| +} |
| + |
| } // namespace profiles |