Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_ | |
| 6 #define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_ | |
| 7 | |
| 8 #include "components/image_fetcher/image_data_fetcher.h" | |
| 9 | |
| 10 namespace image_fetcher { | |
| 11 | |
| 12 // Callback that informs of the download of an image encoded in |data|. | |
| 13 using IOSImageDataFetcherCallback = void (^)(NSData* data); | |
| 14 | |
| 15 class IOSImageDataFetcher : public ImageDataFetcher { | |
|
Marc Treib
2017/01/25 10:37:55
I don't think inheritance is the right tool here.
blundell
2017/01/25 10:46:46
With the caveat that I'm not close to the details
gambard
2017/01/30 13:37:53
Moving to composition.
| |
| 16 public: | |
| 17 // The TaskRunner is used to eventually decode the image. | |
| 18 IOSImageDataFetcher(net::URLRequestContextGetter* url_request_context_getter, | |
| 19 const scoped_refptr<base::TaskRunner>& task_runner); | |
| 20 ~IOSImageDataFetcher() override; | |
| 21 | |
| 22 // Start downloading the image at the given |image_url|. The |callback| will | |
| 23 // be called with the downloaded image, or nil if any error happened or the | |
| 24 // http response header is not HTTP_OK (200). If the url is a data URL, the | |
| 25 // http response header is considered to be HTTP_OK. | |
| 26 void FetchImageDataWebpDecoded(const GURL& image_url, | |
| 27 IOSImageDataFetcherCallback callback); | |
| 28 | |
| 29 private: | |
| 30 // The task runner used to decode images if necessary. | |
| 31 const scoped_refptr<base::TaskRunner> task_runner_; | |
| 32 }; | |
| 33 } // namespace image_fetcher | |
| 34 | |
| 35 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_ | |
| OLD | NEW |