| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/url_request/url_fetcher.h" | 5 #include "net/url_request/url_fetcher.h" |
| 6 | 6 |
| 7 #include "net/url_request/url_fetcher_factory.h" | 7 #include "net/url_request/url_fetcher_factory.h" |
| 8 #include "net/url_request/url_fetcher_impl.h" | 8 #include "net/url_request/url_fetcher_impl.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 URLFetcher::~URLFetcher() {} | 12 URLFetcher::~URLFetcher() {} |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 std::unique_ptr<URLFetcher> URLFetcher::Create( | 15 std::unique_ptr<URLFetcher> URLFetcher::Create( |
| 16 const GURL& url, | 16 const GURL& url, |
| 17 URLFetcher::RequestType request_type, | 17 URLFetcher::RequestType request_type, |
| 18 URLFetcherDelegate* d) { | 18 URLFetcherDelegate* d) { |
| 19 return URLFetcher::Create(0, url, request_type, d); | 19 return URLFetcher::Create(0, url, request_type, d); |
| 20 } | 20 } |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 std::unique_ptr<URLFetcher> URLFetcher::Create( | 23 std::unique_ptr<URLFetcher> URLFetcher::Create( |
| 24 int id, | 24 int id, |
| 25 const GURL& url, | 25 const GURL& url, |
| 26 URLFetcher::RequestType request_type, | 26 URLFetcher::RequestType request_type, |
| 27 URLFetcherDelegate* d) { | 27 URLFetcherDelegate* d) { |
| 28 URLFetcherFactory* factory = URLFetcherImpl::factory(); | 28 return Create(id, url, request_type, d, NO_TRAFFIC_ANNOTATION_YET); |
| 29 return factory ? factory->CreateURLFetcher(id, url, request_type, d) | |
| 30 : std::unique_ptr<URLFetcher>( | |
| 31 new URLFetcherImpl(url, request_type, d)); | |
| 32 } | 29 } |
| 33 | 30 |
| 34 // static | 31 // static |
| 35 std::unique_ptr<URLFetcher> URLFetcher::Create( | 32 std::unique_ptr<URLFetcher> URLFetcher::Create( |
| 36 const GURL& url, | 33 const GURL& url, |
| 37 URLFetcher::RequestType request_type, | 34 URLFetcher::RequestType request_type, |
| 38 URLFetcherDelegate* d, | 35 URLFetcherDelegate* d, |
| 39 NetworkTrafficAnnotationTag traffic_annotation) { | 36 NetworkTrafficAnnotationTag traffic_annotation) { |
| 40 return URLFetcher::Create(0, url, request_type, d, traffic_annotation); | 37 return URLFetcher::Create(0, url, request_type, d, traffic_annotation); |
| 41 } | 38 } |
| 42 | 39 |
| 43 // static | 40 // static |
| 44 std::unique_ptr<URLFetcher> URLFetcher::Create( | 41 std::unique_ptr<URLFetcher> URLFetcher::Create( |
| 45 int id, | 42 int id, |
| 46 const GURL& url, | 43 const GURL& url, |
| 47 URLFetcher::RequestType request_type, | 44 URLFetcher::RequestType request_type, |
| 48 URLFetcherDelegate* d, | 45 URLFetcherDelegate* d, |
| 49 NetworkTrafficAnnotationTag traffic_annotation) { | 46 NetworkTrafficAnnotationTag traffic_annotation) { |
| 50 // traffic_annotation is just a tag that is extracted during static | 47 URLFetcherFactory* factory = URLFetcherImpl::factory(); |
| 51 // code analysis and can be ignored here. | 48 return factory ? factory->CreateURLFetcher(id, url, request_type, d) |
| 52 return Create(id, url, request_type, d); | 49 : std::unique_ptr<URLFetcher>(new URLFetcherImpl( |
| 50 url, request_type, d, traffic_annotation)); |
| 53 } | 51 } |
| 54 | 52 |
| 55 // static | 53 // static |
| 56 void URLFetcher::CancelAll() { | 54 void URLFetcher::CancelAll() { |
| 57 URLFetcherImpl::CancelAll(); | 55 URLFetcherImpl::CancelAll(); |
| 58 } | 56 } |
| 59 | 57 |
| 60 // static | 58 // static |
| 61 void URLFetcher::SetIgnoreCertificateRequests(bool ignored) { | 59 void URLFetcher::SetIgnoreCertificateRequests(bool ignored) { |
| 62 URLFetcherImpl::SetIgnoreCertificateRequests(ignored); | 60 URLFetcherImpl::SetIgnoreCertificateRequests(ignored); |
| 63 } | 61 } |
| 64 | 62 |
| 65 } // namespace net | 63 } // namespace net |
| OLD | NEW |