| 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/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 | 19 |
| 20 class GURL; | 20 class GURL; |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class FilePath; | 23 class FilePath; |
| 24 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 25 class TaskRunner; | 25 class TaskRunner; |
| 26 class TimeDelta; | 26 class TimeDelta; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace url { |
| 30 class Origin; |
| 31 } |
| 32 |
| 29 namespace net { | 33 namespace net { |
| 30 class HostPortPair; | 34 class HostPortPair; |
| 31 class HttpRequestHeaders; | 35 class HttpRequestHeaders; |
| 32 class HttpResponseHeaders; | 36 class HttpResponseHeaders; |
| 33 class URLFetcherDelegate; | 37 class URLFetcherDelegate; |
| 34 class URLFetcherResponseWriter; | 38 class URLFetcherResponseWriter; |
| 35 class URLRequestContextGetter; | 39 class URLRequestContextGetter; |
| 36 class URLRequestStatus; | 40 class URLRequestStatus; |
| 37 | 41 |
| 38 // To use this class, create an instance with the desired URL and a pointer to | 42 // To use this class, create an instance with the desired URL and a pointer to |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Add header (with format field-name ":" [ field-value ]) to the request | 204 // Add header (with format field-name ":" [ field-value ]) to the request |
| 201 // headers. Must be called before the request is started. | 205 // headers. Must be called before the request is started. |
| 202 // This appends the header to the current extra request headers. | 206 // This appends the header to the current extra request headers. |
| 203 virtual void AddExtraRequestHeader(const std::string& header_line) = 0; | 207 virtual void AddExtraRequestHeader(const std::string& header_line) = 0; |
| 204 | 208 |
| 205 // Set the URLRequestContext on the request. Must be called before the | 209 // Set the URLRequestContext on the request. Must be called before the |
| 206 // request is started. | 210 // request is started. |
| 207 virtual void SetRequestContext( | 211 virtual void SetRequestContext( |
| 208 URLRequestContextGetter* request_context_getter) = 0; | 212 URLRequestContextGetter* request_context_getter) = 0; |
| 209 | 213 |
| 210 // Set the URL that should be considered as "initiating" the fetch. This URL | 214 // Set the origin that should be considered as "initiating" the fetch. This |
| 211 // will be considered the "first-party" when applying cookie blocking policy | 215 // URL will be considered the "first-party" when applying cookie blocking |
| 212 // to requests, and treated as the request's initiator. | 216 // policy to requests, and treated as the request's initiator. |
| 213 // | 217 virtual void SetInitiator(const base::Optional<url::Origin>& initiator) = 0; |
| 214 // TODO(mkwst): Convert this to take a 'url::Origin': https://crbug.com/577565 | |
| 215 virtual void SetInitiatorURL(const GURL& initiator) = 0; | |
| 216 | 218 |
| 217 // Set the key and data callback that is used when setting the user | 219 // Set the key and data callback that is used when setting the user |
| 218 // data on any URLRequest objects this object creates. | 220 // data on any URLRequest objects this object creates. |
| 219 virtual void SetURLRequestUserData( | 221 virtual void SetURLRequestUserData( |
| 220 const void* key, | 222 const void* key, |
| 221 const CreateDataCallback& create_data_callback) = 0; | 223 const CreateDataCallback& create_data_callback) = 0; |
| 222 | 224 |
| 223 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt | 225 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt |
| 224 // immediately rather than continue through the redirect. OnURLFetchComplete | 226 // immediately rather than continue through the redirect. OnURLFetchComplete |
| 225 // will be called, with the URLFetcher's URL set to the redirect destination, | 227 // will be called, with the URLFetcher's URL set to the redirect destination, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // be removed once the URLFetcher is destroyed. User should not take | 330 // be removed once the URLFetcher is destroyed. User should not take |
| 329 // ownership more than once, or call this method after taking ownership. | 331 // ownership more than once, or call this method after taking ownership. |
| 330 virtual bool GetResponseAsFilePath( | 332 virtual bool GetResponseAsFilePath( |
| 331 bool take_ownership, | 333 bool take_ownership, |
| 332 base::FilePath* out_response_path) const = 0; | 334 base::FilePath* out_response_path) const = 0; |
| 333 }; | 335 }; |
| 334 | 336 |
| 335 } // namespace net | 337 } // namespace net |
| 336 | 338 |
| 337 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 339 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
| OLD | NEW |