| 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 #ifndef IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ | 5 #ifndef IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ |
| 6 #define IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ | 6 #define IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/image_fetcher/image_fetcher.h" | 12 #include "components/image_fetcher/image_fetcher.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 class ImageFetcher; | 15 class ImageFetcher; |
| 16 class SkBitmap; | 16 |
| 17 namespace base { |
| 18 class SequencedWorkerPool; |
| 19 } |
| 20 |
| 21 namespace gfx { |
| 22 class Image; |
| 23 } |
| 17 | 24 |
| 18 namespace image_fetcher { | 25 namespace image_fetcher { |
| 19 class ImageFetcherDelegate; | 26 class ImageFetcherDelegate; |
| 20 } | 27 } |
| 21 | 28 |
| 22 namespace base { | |
| 23 class SequencedWorkerPool; | |
| 24 } | |
| 25 | |
| 26 namespace net { | 29 namespace net { |
| 27 class URLRequestContextGetter; | 30 class URLRequestContextGetter; |
| 28 } | 31 } |
| 29 | 32 |
| 30 namespace suggestions { | 33 namespace suggestions { |
| 31 | 34 |
| 32 // A class used to fetch server images asynchronously. | 35 // A class used to fetch server images asynchronously. |
| 33 class ImageFetcherImpl : public image_fetcher::ImageFetcher { | 36 class ImageFetcherImpl : public image_fetcher::ImageFetcher { |
| 34 public: | 37 public: |
| 35 ImageFetcherImpl(net::URLRequestContextGetter* url_request_context, | 38 ImageFetcherImpl(net::URLRequestContextGetter* url_request_context, |
| 36 base::SequencedWorkerPool* blocking_pool); | 39 base::SequencedWorkerPool* blocking_pool); |
| 37 ~ImageFetcherImpl() override; | 40 ~ImageFetcherImpl() override; |
| 38 | 41 |
| 39 void SetImageFetcherDelegate( | 42 void SetImageFetcherDelegate( |
| 40 image_fetcher::ImageFetcherDelegate* delegate) override; | 43 image_fetcher::ImageFetcherDelegate* delegate) override; |
| 41 | 44 |
| 42 void StartOrQueueNetworkRequest( | 45 void StartOrQueueNetworkRequest( |
| 43 const GURL& url, | 46 const GURL& url, |
| 44 const GURL& image_url, | 47 const GURL& image_url, |
| 45 base::Callback<void(const GURL&, const SkBitmap*)> callback) override; | 48 base::Callback<void(const GURL&, const gfx::Image&)> callback) override; |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 std::unique_ptr<::ImageFetcher> imageFetcher_; | 51 std::unique_ptr<::ImageFetcher> imageFetcher_; |
| 49 | 52 |
| 50 image_fetcher::ImageFetcherDelegate* delegate_; | 53 image_fetcher::ImageFetcherDelegate* delegate_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); | 55 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 } // namespace suggestions | 58 } // namespace suggestions |
| 56 | 59 |
| 57 #endif // IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ | 60 #endif // IOS_CHROME_BROWSER_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_ |
| OLD | NEW |