Chromium Code Reviews| 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 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ |
| 6 #define NET_URL_REQUEST_URL_FETCHER_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/supports_user_data.h" | 16 #include "base/supports_user_data.h" |
| 17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 18 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 18 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class FilePath; | 24 class FilePath; |
| 24 class SequencedTaskRunner; | 25 class SequencedTaskRunner; |
| 25 class TaskRunner; | 26 class TaskRunner; |
| 26 class TimeDelta; | 27 class TimeDelta; |
| 27 } | 28 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 | 95 |
| 95 // Used by SetUploadStreamFactory. The callback should assign a fresh upload | 96 // Used by SetUploadStreamFactory. The callback should assign a fresh upload |
| 96 // data stream every time it's called. | 97 // data stream every time it's called. |
| 97 typedef base::Callback<std::unique_ptr<UploadDataStream>()> | 98 typedef base::Callback<std::unique_ptr<UploadDataStream>()> |
| 98 CreateUploadStreamCallback; | 99 CreateUploadStreamCallback; |
| 99 | 100 |
| 100 virtual ~URLFetcher(); | 101 virtual ~URLFetcher(); |
| 101 | 102 |
| 102 // |url| is the URL to send the request to. It must be valid. | 103 // |url| is the URL to send the request to. It must be valid. |
| 103 // |request_type| is the type of request to make. | 104 // |request_type| is the type of request to make. |
| 104 // |d| the object that will receive the callback on fetch completion. | 105 // |d| the object that will receive the callback on fetch completion. |
|
battre
2016/10/17 14:58:46
// DEPRECATED: Please use the version with Network
Ramin Halavati
2016/10/18 06:57:56
Done.
| |
| 105 static std::unique_ptr<URLFetcher> Create( | 106 static std::unique_ptr<URLFetcher> Create( |
| 106 const GURL& url, | 107 const GURL& url, |
| 107 URLFetcher::RequestType request_type, | 108 URLFetcher::RequestType request_type, |
| 108 URLFetcherDelegate* d); | 109 URLFetcherDelegate* d); |
| 109 | 110 |
| 110 // Like above, but if there's a URLFetcherFactory registered with the | 111 // Like above, but if there's a URLFetcherFactory registered with the |
| 111 // implementation it will be used. |id| may be used during testing to identify | 112 // implementation it will be used. |id| may be used during testing to identify |
| 112 // who is creating the URLFetcher. | 113 // who is creating the URLFetcher. |
|
battre
2016/10/17 14:58:46
// DEPRECATED: Please use the version with Network
Ramin Halavati
2016/10/18 06:57:56
Done.
| |
| 113 static std::unique_ptr<URLFetcher> Create( | 114 static std::unique_ptr<URLFetcher> Create( |
| 114 int id, | 115 int id, |
| 115 const GURL& url, | 116 const GURL& url, |
| 116 URLFetcher::RequestType request_type, | 117 URLFetcher::RequestType request_type, |
| 117 URLFetcherDelegate* d); | 118 URLFetcherDelegate* d); |
| 118 | 119 |
| 120 // |url| is the URL to send the request to. It must be valid. | |
| 121 // |request_type| is the type of request to make. | |
| 122 // |d| the object that will receive the callback on fetch completion. | |
|
battre
2016/10/17 14:58:46
// |traffic_annotation| metadata about the network
Ramin Halavati
2016/10/18 06:57:56
Done.
| |
| 123 // This function is a proposed replacement of original Create function to add | |
| 124 // traffic annotation as a mandatory parameter. | |
|
battre
2016/10/17 14:58:46
Delete this sentence.
Ramin Halavati
2016/10/18 06:57:56
Done.
| |
| 125 static std::unique_ptr<URLFetcher> Create( | |
| 126 const GURL& url, | |
| 127 URLFetcher::RequestType request_type, | |
| 128 URLFetcherDelegate* d, | |
| 129 NetworkTrafficAnnotationTag traffic_annotation); | |
| 130 | |
| 131 // Like above, but if there's a URLFetcherFactory registered with the | |
| 132 // implementation it will be used. |id| may be used during testing to identify | |
| 133 // who is creating the URLFetcher. | |
| 134 // This function is a proposed replacement of original Create function to add | |
| 135 // traffic annotation as a mandatory parameter. | |
|
battre
2016/10/17 14:58:46
Delete this sentence.
Ramin Halavati
2016/10/18 06:57:56
Done.
| |
| 136 static std::unique_ptr<URLFetcher> Create( | |
| 137 int id, | |
| 138 const GURL& url, | |
| 139 URLFetcher::RequestType request_type, | |
| 140 URLFetcherDelegate* d, | |
| 141 NetworkTrafficAnnotationTag traffic_annotation); | |
| 142 | |
| 119 // Cancels all existing URLFetchers. Will notify the URLFetcherDelegates. | 143 // Cancels all existing URLFetchers. Will notify the URLFetcherDelegates. |
| 120 // Note that any new URLFetchers created while this is running will not be | 144 // Note that any new URLFetchers created while this is running will not be |
| 121 // cancelled. Typically, one would call this in the CleanUp() method of an IO | 145 // cancelled. Typically, one would call this in the CleanUp() method of an IO |
| 122 // thread, so that no new URLRequests would be able to start on the IO thread | 146 // thread, so that no new URLRequests would be able to start on the IO thread |
| 123 // anyway. This doesn't prevent new URLFetchers from trying to post to the IO | 147 // anyway. This doesn't prevent new URLFetchers from trying to post to the IO |
| 124 // thread though, even though the task won't ever run. | 148 // thread though, even though the task won't ever run. |
| 125 static void CancelAll(); | 149 static void CancelAll(); |
| 126 | 150 |
| 127 // Normally, URLFetcher will abort loads that request SSL client certificate | 151 // Normally, URLFetcher will abort loads that request SSL client certificate |
| 128 // authentication, but this method may be used to cause URLFetchers to ignore | 152 // authentication, but this method may be used to cause URLFetchers to ignore |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 // be removed once the URLFetcher is destroyed. User should not take | 352 // be removed once the URLFetcher is destroyed. User should not take |
| 329 // ownership more than once, or call this method after taking ownership. | 353 // ownership more than once, or call this method after taking ownership. |
| 330 virtual bool GetResponseAsFilePath( | 354 virtual bool GetResponseAsFilePath( |
| 331 bool take_ownership, | 355 bool take_ownership, |
| 332 base::FilePath* out_response_path) const = 0; | 356 base::FilePath* out_response_path) const = 0; |
| 333 }; | 357 }; |
| 334 | 358 |
| 335 } // namespace net | 359 } // namespace net |
| 336 | 360 |
| 337 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 361 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
| OLD | NEW |