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