OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ |
6 #define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "components/data_use_measurement/core/data_use_user_data.h" | 11 #include "components/data_use_measurement/core/data_use_user_data.h" |
12 #include "components/image_fetcher/image_data_fetcher.h" | 12 #include "components/image_fetcher/image_data_fetcher.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class TaskRunner; | 15 class TaskRunner; |
16 } | 16 } |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
20 } | 20 } |
21 | 21 |
22 class GURL; | 22 class GURL; |
23 | 23 |
24 namespace image_fetcher { | 24 namespace image_fetcher { |
25 | 25 |
26 // Callback that informs of the download of an image encoded in |data|. | 26 // Callback that informs of the download of an image encoded in |data|. |
gambard
2017/02/06 12:21:46
Update comment for response_code.
gambard
2017/02/06 15:58:28
Done.
| |
27 using IOSImageDataFetcherCallback = void (^)(NSData* data); | 27 using IOSImageDataFetcherCallback = void (^)(const int response_code, |
28 NSData* data); | |
Marc Treib
2017/02/06 12:35:49
nit: data first, then response_code? To be consist
gambard
2017/02/06 15:58:28
Done.
| |
28 | 29 |
29 class IOSImageDataFetcherWrapper { | 30 class IOSImageDataFetcherWrapper { |
30 public: | 31 public: |
31 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; | 32 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; |
32 | 33 |
33 // The TaskRunner is used to decode the image if it is WebP-encoded. | 34 // The TaskRunner is used to decode the image if it is WebP-encoded. |
34 IOSImageDataFetcherWrapper( | 35 IOSImageDataFetcherWrapper( |
35 net::URLRequestContextGetter* url_request_context_getter, | 36 net::URLRequestContextGetter* url_request_context_getter, |
36 const scoped_refptr<base::TaskRunner>& task_runner); | 37 const scoped_refptr<base::TaskRunner>& task_runner); |
37 virtual ~IOSImageDataFetcherWrapper(); | 38 virtual ~IOSImageDataFetcherWrapper(); |
(...skipping 25 matching lines...) Expand all Loading... | |
63 // The task runner used to decode images if necessary. | 64 // The task runner used to decode images if necessary. |
64 const scoped_refptr<base::TaskRunner> task_runner_; | 65 const scoped_refptr<base::TaskRunner> task_runner_; |
65 ImageDataFetcher image_data_fetcher_; | 66 ImageDataFetcher image_data_fetcher_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper); | 68 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper); |
68 }; | 69 }; |
69 | 70 |
70 } // namespace image_fetcher | 71 } // namespace image_fetcher |
71 | 72 |
72 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ | 73 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ |
OLD | NEW |