| 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_CORE_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); | 80 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); |
| 81 // |flags| are flags to apply to the load operation--these should be | 81 // |flags| are flags to apply to the load operation--these should be |
| 82 // one or more of the LOAD_* flags defined in net/base/load_flags.h. | 82 // one or more of the LOAD_* flags defined in net/base/load_flags.h. |
| 83 void SetLoadFlags(int load_flags); | 83 void SetLoadFlags(int load_flags); |
| 84 int GetLoadFlags() const; | 84 int GetLoadFlags() const; |
| 85 void SetReferrer(const std::string& referrer); | 85 void SetReferrer(const std::string& referrer); |
| 86 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy); | 86 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy); |
| 87 void SetExtraRequestHeaders(const std::string& extra_request_headers); | 87 void SetExtraRequestHeaders(const std::string& extra_request_headers); |
| 88 void AddExtraRequestHeader(const std::string& header_line); | 88 void AddExtraRequestHeader(const std::string& header_line); |
| 89 void SetRequestContext(URLRequestContextGetter* request_context_getter); | 89 void SetRequestContext(URLRequestContextGetter* request_context_getter); |
| 90 // Set the URL that should be considered as "initiating" the fetch. This URL | 90 // Set the origin that should be considered as "initiating" the fetch. This |
| 91 // URL |
| 91 // will be considered the "first-party" when applying cookie blocking policy | 92 // will be considered the "first-party" when applying cookie blocking policy |
| 92 // to requests, and treated as the request's initiator. | 93 // to requests, and treated as the request's initiator. |
| 93 // | 94 void SetInitiator(const base::Optional<url::Origin>& initiator); |
| 94 // TODO(mkwst): Convert this to a url::Origin. https://crbug.com/577565 | |
| 95 void SetInitiatorURL(const GURL& initiator); | |
| 96 // Set the key and data callback that is used when setting the user | 95 // Set the key and data callback that is used when setting the user |
| 97 // data on any URLRequest objects this object creates. | 96 // data on any URLRequest objects this object creates. |
| 98 void SetURLRequestUserData( | 97 void SetURLRequestUserData( |
| 99 const void* key, | 98 const void* key, |
| 100 const URLFetcher::CreateDataCallback& create_data_callback); | 99 const URLFetcher::CreateDataCallback& create_data_callback); |
| 101 void SetStopOnRedirect(bool stop_on_redirect); | 100 void SetStopOnRedirect(bool stop_on_redirect); |
| 102 void SetAutomaticallyRetryOn5xx(bool retry); | 101 void SetAutomaticallyRetryOn5xx(bool retry); |
| 103 void SetMaxRetriesOn5xx(int max_retries); | 102 void SetMaxRetriesOn5xx(int max_retries); |
| 104 int GetMaxRetriesOn5xx() const; | 103 int GetMaxRetriesOn5xx() const; |
| 105 base::TimeDelta GetBackoffDelay() const; | 104 base::TimeDelta GetBackoffDelay() const; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 239 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 241 // Task runner for upload file access. | 240 // Task runner for upload file access. |
| 242 scoped_refptr<base::TaskRunner> upload_file_task_runner_; | 241 scoped_refptr<base::TaskRunner> upload_file_task_runner_; |
| 243 std::unique_ptr<URLRequest> request_; // The actual request this wraps | 242 std::unique_ptr<URLRequest> request_; // The actual request this wraps |
| 244 int load_flags_; // Flags for the load operation | 243 int load_flags_; // Flags for the load operation |
| 245 int response_code_; // HTTP status code for the request | 244 int response_code_; // HTTP status code for the request |
| 246 scoped_refptr<IOBuffer> buffer_; | 245 scoped_refptr<IOBuffer> buffer_; |
| 247 // Read buffer | 246 // Read buffer |
| 248 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 247 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
| 249 // Cookie/cache info for the request | 248 // Cookie/cache info for the request |
| 250 GURL initiator_; // The request's initiator | 249 base::Optional<url::Origin> initiator_; // The request's initiator |
| 251 // The user data to add to each newly-created URLRequest. | 250 // The user data to add to each newly-created URLRequest. |
| 252 const void* url_request_data_key_; | 251 const void* url_request_data_key_; |
| 253 URLFetcher::CreateDataCallback url_request_create_data_callback_; | 252 URLFetcher::CreateDataCallback url_request_create_data_callback_; |
| 254 HttpRequestHeaders extra_request_headers_; | 253 HttpRequestHeaders extra_request_headers_; |
| 255 scoped_refptr<HttpResponseHeaders> response_headers_; | 254 scoped_refptr<HttpResponseHeaders> response_headers_; |
| 256 bool was_fetched_via_proxy_; | 255 bool was_fetched_via_proxy_; |
| 257 bool was_cached_; | 256 bool was_cached_; |
| 258 int64_t received_response_content_length_; | 257 int64_t received_response_content_length_; |
| 259 int64_t total_received_bytes_; | 258 int64_t total_received_bytes_; |
| 260 HostPortPair socket_address_; | 259 HostPortPair socket_address_; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 int64_t total_response_bytes_; | 346 int64_t total_response_bytes_; |
| 348 | 347 |
| 349 static base::LazyInstance<Registry> g_registry; | 348 static base::LazyInstance<Registry> g_registry; |
| 350 | 349 |
| 351 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 350 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
| 352 }; | 351 }; |
| 353 | 352 |
| 354 } // namespace net | 353 } // namespace net |
| 355 | 354 |
| 356 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 355 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| OLD | NEW |