| 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 COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ |
| 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "components/image_fetcher/image_fetcher_delegate.h" | 10 #include "components/image_fetcher/image_fetcher_delegate.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 class SkBitmap; | 13 namespace gfx { |
| 14 class Image; |
| 15 } |
| 14 | 16 |
| 15 namespace image_fetcher { | 17 namespace image_fetcher { |
| 16 | 18 |
| 17 // A class used to fetch server images. It can be called from any thread and the | 19 // A class used to fetch server images. It can be called from any thread and the |
| 18 // callback will be called on the thread which initiated the fetch. | 20 // callback will be called on the thread which initiated the fetch. |
| 19 class ImageFetcher { | 21 class ImageFetcher { |
| 20 public: | 22 public: |
| 21 ImageFetcher() {} | 23 ImageFetcher() {} |
| 22 virtual ~ImageFetcher() {} | 24 virtual ~ImageFetcher() {} |
| 23 | 25 |
| 24 virtual void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) = 0; | 26 virtual void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) = 0; |
| 25 | 27 |
| 28 // An empty gfx::Image will be returned to the callback in case the image |
| 29 // could not be fetched. |
| 26 virtual void StartOrQueueNetworkRequest( | 30 virtual void StartOrQueueNetworkRequest( |
| 27 const GURL& url, | 31 const GURL& url, |
| 28 const GURL& image_url, | 32 const GURL& image_url, |
| 29 base::Callback<void(const GURL&, const SkBitmap*)> callback) = 0; | 33 base::Callback<void(const GURL&, const gfx::Image&)> callback) = 0; |
| 30 | 34 |
| 31 private: | 35 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(ImageFetcher); | 36 DISALLOW_COPY_AND_ASSIGN(ImageFetcher); |
| 33 }; | 37 }; |
| 34 | 38 |
| 35 } // namespace image_fetcher | 39 } // namespace image_fetcher |
| 36 | 40 |
| 37 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ | 41 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_ |
| OLD | NEW |