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| and the |
| 27 // associated metadata. If an error prevented a http response, |
| 28 // |metadata.http_response_code| will be RESPONSE_CODE_INVALID. |
27 using IOSImageDataFetcherCallback = void (^)(NSData* data, | 29 using IOSImageDataFetcherCallback = void (^)(NSData* data, |
28 const RequestMetadata& metadata); | 30 const RequestMetadata& metadata); |
29 | 31 |
30 class IOSImageDataFetcherWrapper { | 32 class IOSImageDataFetcherWrapper { |
31 public: | 33 public: |
32 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; | 34 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; |
33 | 35 |
34 // The TaskRunner is used to decode the image if it is WebP-encoded. | 36 // The TaskRunner is used to decode the image if it is WebP-encoded. |
35 IOSImageDataFetcherWrapper( | 37 IOSImageDataFetcherWrapper( |
36 net::URLRequestContextGetter* url_request_context_getter, | 38 net::URLRequestContextGetter* url_request_context_getter, |
(...skipping 27 matching lines...) Expand all Loading... |
64 // The task runner used to decode images if necessary. | 66 // The task runner used to decode images if necessary. |
65 const scoped_refptr<base::TaskRunner> task_runner_; | 67 const scoped_refptr<base::TaskRunner> task_runner_; |
66 ImageDataFetcher image_data_fetcher_; | 68 ImageDataFetcher image_data_fetcher_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper); | 70 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace image_fetcher | 73 } // namespace image_fetcher |
72 | 74 |
73 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ | 75 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ |
OLD | NEW |