| 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_DELEGATE_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_ |
| 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 | 11 |
| 10 class GURL; | |
| 11 | |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Image; | 13 class Image; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace image_fetcher { | 16 namespace image_fetcher { |
| 17 | 17 |
| 18 class ImageFetcherDelegate { | 18 class ImageFetcherDelegate { |
| 19 public: | 19 public: |
| 20 ImageFetcherDelegate() {} | 20 ImageFetcherDelegate() {} |
| 21 | 21 |
| 22 // Called when an image was fetched. |id| is an identifier for the fetch (as | 22 // Called when the data for an image was fetched. |id| is an identifier for |
| 23 // passed to ImageFetcher::StartOrQueueNetworkRequest); |image| stores image | 23 // the fetch (as passed to ImageFetcher::StartOrQueueNetworkRequest); |data| |
| 24 // data owned by the caller, and can be an empty gfx::Image. | 24 // stores (generally compressed) image data owned by the caller, and can be |
| 25 // empty if the fetch failed. |
| 26 virtual void OnImageDataFetched(const std::string& id, |
| 27 const std::string& data) {}; |
| 28 |
| 29 // Called when an image was fetched and decoded. |id| is an identifier for the |
| 30 // fetch (as passed to ImageFetcher::StartOrQueueNetworkRequest); |image| |
| 31 // stores image data owned by the caller, and can be an empty gfx::Image. |
| 25 virtual void OnImageFetched(const std::string& id, | 32 virtual void OnImageFetched(const std::string& id, |
| 26 const gfx::Image& image) = 0; | 33 const gfx::Image& image) {}; |
| 27 | 34 |
| 28 protected: | 35 protected: |
| 29 virtual ~ImageFetcherDelegate() {} | 36 virtual ~ImageFetcherDelegate() {} |
| 30 | 37 |
| 31 DISALLOW_COPY_AND_ASSIGN(ImageFetcherDelegate); | 38 DISALLOW_COPY_AND_ASSIGN(ImageFetcherDelegate); |
| 32 }; | 39 }; |
| 33 | 40 |
| 34 } // namespace image_fetcher | 41 } // namespace image_fetcher |
| 35 | 42 |
| 36 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_ | 43 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_ |
| OLD | NEW |