Chromium Code Reviews| Index: ios/chrome/browser/suggestions/image_fetcher_impl.mm |
| diff --git a/ios/chrome/browser/suggestions/image_fetcher_impl.mm b/ios/chrome/browser/suggestions/image_fetcher_impl.mm |
| index 70d93428d5d597d3fdd4bb2fe9b7ddd5c812bc81..47b1f946ae63a3266f7003db92aa3f2994d9eab4 100644 |
| --- a/ios/chrome/browser/suggestions/image_fetcher_impl.mm |
| +++ b/ios/chrome/browser/suggestions/image_fetcher_impl.mm |
| @@ -8,7 +8,7 @@ |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "components/image_fetcher/image_fetcher_delegate.h" |
| -#include "ios/chrome/browser/net/image_fetcher.h" |
| +#include "components/image_fetcher/ios/raw_image_fetcher.h" |
| #include "net/url_request/url_request_context_getter.h" |
| #include "skia/ext/skia_utils_ios.h" |
| #include "ui/gfx/image/image.h" |
| @@ -18,7 +18,7 @@ namespace suggestions { |
| ImageFetcherImpl::ImageFetcherImpl( |
| net::URLRequestContextGetter* url_request_context, |
| base::SequencedWorkerPool* blocking_pool) { |
| - imageFetcher_.reset(new ::ImageFetcher(blocking_pool)); |
| + imageFetcher_.reset(new image_fetcher::RawImageFetcher(blocking_pool)); |
|
sdefresne
2016/11/23 14:40:33
Can you use base::MakeUnique<> here?
ImageFetcher
gambard
2016/11/23 15:01:21
Done.
|
| imageFetcher_->SetRequestContextGetter(url_request_context); |
| } |
| @@ -52,26 +52,26 @@ void ImageFetcherImpl::StartOrQueueNetworkRequest( |
| } |
| // Copy string reference so it's retained. |
| const std::string fetch_id(id); |
| - ImageFetchedCallback fetcher_callback = |
| + image_fetcher::ImageFetchedCallback fetcher_callback = |
| ^(const GURL& original_url, int response_code, NSData* data) { |
| - if (data) { |
| - // Most likely always returns 1x images. |
| - UIImage* ui_image = [UIImage imageWithData:data scale:1]; |
| - if (ui_image) { |
| - gfx::Image gfx_image(ui_image); |
| - callback.Run(fetch_id, gfx_image); |
| - if (delegate_) { |
| - delegate_->OnImageFetched(fetch_id, gfx_image); |
| + if (data) { |
| + // Most likely always returns 1x images. |
| + UIImage* ui_image = [UIImage imageWithData:data scale:1]; |
| + if (ui_image) { |
| + gfx::Image gfx_image(ui_image); |
| + callback.Run(fetch_id, gfx_image); |
| + if (delegate_) { |
| + delegate_->OnImageFetched(fetch_id, gfx_image); |
| + } |
| + return; |
| } |
| - return; |
| } |
| - } |
| - gfx::Image empty_image; |
| - callback.Run(fetch_id, empty_image); |
| - if (delegate_) { |
| - delegate_->OnImageFetched(fetch_id, empty_image); |
| - } |
| - }; |
| + gfx::Image empty_image; |
| + callback.Run(fetch_id, empty_image); |
| + if (delegate_) { |
| + delegate_->OnImageFetched(fetch_id, empty_image); |
| + } |
| + }; |
| imageFetcher_->StartDownload(image_url, fetcher_callback); |
| } |