OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ios/chrome/browser/suggestions/image_fetcher_impl.h" | 5 #include "ios/chrome/browser/suggestions/image_fetcher_impl.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "components/image_fetcher/image_fetcher_delegate.h" | 11 #include "components/image_fetcher/image_fetcher_delegate.h" |
12 #import "ios/web/public/image_fetcher/image_data_fetcher.h" | 12 #import "ios/web/public/image_fetcher/image_data_fetcher.h" |
13 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
14 #include "skia/ext/skia_utils_ios.h" | 14 #include "skia/ext/skia_utils_ios.h" |
15 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
16 | 16 |
| 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 18 #error "This file requires ARC support." |
| 19 #endif |
| 20 |
17 namespace suggestions { | 21 namespace suggestions { |
18 | 22 |
19 ImageFetcherImpl::ImageFetcherImpl( | 23 ImageFetcherImpl::ImageFetcherImpl( |
20 net::URLRequestContextGetter* url_request_context, | 24 net::URLRequestContextGetter* url_request_context, |
21 base::SequencedWorkerPool* blocking_pool) | 25 base::SequencedWorkerPool* blocking_pool) |
22 : image_fetcher_(base::MakeUnique<web::ImageDataFetcher>(blocking_pool)) { | 26 : image_fetcher_(base::MakeUnique<web::ImageDataFetcher>(blocking_pool)) { |
23 image_fetcher_->SetRequestContextGetter(url_request_context); | 27 image_fetcher_->SetRequestContextGetter(url_request_context); |
24 } | 28 } |
25 | 29 |
26 ImageFetcherImpl::~ImageFetcherImpl() { | 30 ImageFetcherImpl::~ImageFetcherImpl() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 gfx::Image empty_image; | 76 gfx::Image empty_image; |
73 callback.Run(fetch_id, empty_image); | 77 callback.Run(fetch_id, empty_image); |
74 if (delegate_) { | 78 if (delegate_) { |
75 delegate_->OnImageFetched(fetch_id, empty_image); | 79 delegate_->OnImageFetched(fetch_id, empty_image); |
76 } | 80 } |
77 }; | 81 }; |
78 image_fetcher_->StartDownload(image_url, fetcher_callback); | 82 image_fetcher_->StartDownload(image_url, fetcher_callback); |
79 } | 83 } |
80 | 84 |
81 } // namespace suggestions | 85 } // namespace suggestions |
OLD | NEW |