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

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

Issue 845373002: Change default code flag to NewAvatarMenu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Linux compile Created 5 years, 9 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_avatar_downloader.cc
diff --git a/chrome/browser/profiles/profile_avatar_downloader.cc b/chrome/browser/profiles/profile_avatar_downloader.cc
index f00dc76122dbc4e04d42a010664575c34a58d431..f41ac6cd6a3b77463b3ca46f6543efc22a409d9e 100644
--- a/chrome/browser/profiles/profile_avatar_downloader.cc
+++ b/chrome/browser/profiles/profile_avatar_downloader.cc
@@ -22,6 +22,12 @@ ProfileAvatarDownloader::ProfileAvatarDownloader(
ProfileInfoCache* cache)
: icon_index_(icon_index),
profile_path_(profile_path),
+ // The downloader should only execute on desktop platforms.
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+ downloader_active_(true),
+#else
+ downloader_active_(false),
+#endif
cache_(cache) {
GURL url(std::string(kHighResAvatarDownloadUrlPrefix) +
profiles::GetDefaultAvatarIconFileNameAtIndex(icon_index));
@@ -32,21 +38,23 @@ ProfileAvatarDownloader::~ProfileAvatarDownloader() {
}
void ProfileAvatarDownloader::Start() {
- // In unit tests, the browser process can return a NULL request context.
- net::URLRequestContextGetter* request_context =
- g_browser_process->system_request_context();
- if (request_context)
- fetcher_->Start(
- request_context,
- std::string(),
- net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
- net::LOAD_NORMAL);
+ if (downloader_active_) {
noms (inactive) 2015/03/17 14:26:30 nit: i would return early if !downloader_active
Mike Lerman 2015/03/18 19:29:48 Done.
+ // In unit tests, the browser process can return a NULL request context.
+ net::URLRequestContextGetter* request_context =
+ g_browser_process->system_request_context();
+ if (request_context)
+ fetcher_->Start(
+ request_context,
+ std::string(),
+ net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
+ net::LOAD_NORMAL);
+ }
}
// BitmapFetcherDelegate overrides.
void ProfileAvatarDownloader::OnFetchComplete(const GURL url,
const SkBitmap* bitmap) {
- if (!bitmap || !cache_)
+ if (!bitmap || !cache_ || !downloader_active_)
return;
// Decode the downloaded bitmap. Ownership of the image is taken by |cache_|.

Powered by Google App Engine
This is Rietveld 408576698