Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: Annotation updated. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h" 5 #import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h"
6 6
7 #import "base/mac/bind_objc_block.h" 7 #import "base/mac/bind_objc_block.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
11 #import "components/image_fetcher/ios/webp_decoder.h" 11 #import "components/image_fetcher/ios/webp_decoder.h"
12 #include "net/http/http_response_headers.h" 12 #include "net/http/http_response_headers.h"
13 #include "net/http/http_status_code.h" 13 #include "net/http/http_status_code.h"
14 #include "net/traffic_annotation/network_traffic_annotation.h"
14 #include "net/url_request/url_fetcher.h" 15 #include "net/url_request/url_fetcher.h"
15 #include "url/url_constants.h" 16 #include "url/url_constants.h"
16 17
17 #if !defined(__has_feature) || !__has_feature(objc_arc) 18 #if !defined(__has_feature) || !__has_feature(objc_arc)
18 #error "This file requires ARC support." 19 #error "This file requires ARC support."
19 #endif 20 #endif
20 21
21 #pragma mark - IOSImageDataFetcherWrapper 22 #pragma mark - IOSImageDataFetcherWrapper
22 23
23 namespace image_fetcher { 24 namespace image_fetcher {
24 25
25 IOSImageDataFetcherWrapper::IOSImageDataFetcherWrapper( 26 IOSImageDataFetcherWrapper::IOSImageDataFetcherWrapper(
26 net::URLRequestContextGetter* url_request_context_getter, 27 net::URLRequestContextGetter* url_request_context_getter,
27 const scoped_refptr<base::TaskRunner>& task_runner) 28 const scoped_refptr<base::TaskRunner>& task_runner)
28 : task_runner_(task_runner), 29 : task_runner_(task_runner),
29 image_data_fetcher_(url_request_context_getter) { 30 image_data_fetcher_(url_request_context_getter) {
30 DCHECK(task_runner_.get()); 31 DCHECK(task_runner_.get());
31 } 32 }
32 33
33 IOSImageDataFetcherWrapper::~IOSImageDataFetcherWrapper() {} 34 IOSImageDataFetcherWrapper::~IOSImageDataFetcherWrapper() {}
34 35
35 void IOSImageDataFetcherWrapper::FetchImageDataWebpDecoded( 36 void IOSImageDataFetcherWrapper::FetchImageDataWebpDecoded(
36 const GURL& image_url, 37 const GURL& image_url,
37 IOSImageDataFetcherCallback callback) { 38 IOSImageDataFetcherCallback callback) {
38 image_data_fetcher_.FetchImageData(image_url, 39 image_data_fetcher_.FetchImageData(image_url,
39 CallbackForImageDataFetcher(callback)); 40 CallbackForImageDataFetcher(callback),
41 NO_TRAFFIC_ANNOTATION_YET);
40 } 42 }
41 43
42 void IOSImageDataFetcherWrapper::FetchImageDataWebpDecoded( 44 void IOSImageDataFetcherWrapper::FetchImageDataWebpDecoded(
43 const GURL& image_url, 45 const GURL& image_url,
44 IOSImageDataFetcherCallback callback, 46 IOSImageDataFetcherCallback callback,
45 const std::string& referrer, 47 const std::string& referrer,
46 net::URLRequest::ReferrerPolicy referrer_policy) { 48 net::URLRequest::ReferrerPolicy referrer_policy) {
47 DCHECK(callback); 49 DCHECK(callback);
48 50
49 image_data_fetcher_.FetchImageData(image_url, 51 image_data_fetcher_.FetchImageData(
50 CallbackForImageDataFetcher(callback), 52 image_url, CallbackForImageDataFetcher(callback), referrer,
51 referrer, referrer_policy); 53 referrer_policy, NO_TRAFFIC_ANNOTATION_YET);
52 } 54 }
53 55
54 void IOSImageDataFetcherWrapper::SetDataUseServiceName( 56 void IOSImageDataFetcherWrapper::SetDataUseServiceName(
55 DataUseServiceName data_use_service_name) { 57 DataUseServiceName data_use_service_name) {
56 image_data_fetcher_.SetDataUseServiceName(data_use_service_name); 58 image_data_fetcher_.SetDataUseServiceName(data_use_service_name);
57 } 59 }
58 60
59 ImageDataFetcher::ImageDataFetcherCallback 61 ImageDataFetcher::ImageDataFetcherCallback
60 IOSImageDataFetcherWrapper::CallbackForImageDataFetcher( 62 IOSImageDataFetcherWrapper::CallbackForImageDataFetcher(
61 IOSImageDataFetcherCallback callback) { 63 IOSImageDataFetcherCallback callback) {
(...skipping 17 matching lines...) Expand all
79 task_runner.get(), FROM_HERE, base::BindBlockArc(^NSData*() { 81 task_runner.get(), FROM_HERE, base::BindBlockArc(^NSData*() {
80 return webp_transcode::WebpDecoder::DecodeWebpImage(data); 82 return webp_transcode::WebpDecoder::DecodeWebpImage(data);
81 }), 83 }),
82 base::BindBlockArc(^(NSData* decodedData) { 84 base::BindBlockArc(^(NSData* decodedData) {
83 callback(decodedData, webp_metadata); 85 callback(decodedData, webp_metadata);
84 })); 86 }));
85 }); 87 });
86 } 88 }
87 89
88 } // namespace image_fetcher 90 } // namespace image_fetcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698