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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/debug/stack_trace.h" | 13 #include "base/debug/stack_trace.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
20 #include "net/http/http_request_headers.h" | 20 #include "net/http/http_request_headers.h" |
21 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
23 #include "net/url_request/url_request_context_getter_observer.h" | 23 #include "net/url_request/url_request_context_getter_observer.h" |
24 #include "net/url_request/url_request_status.h" | 24 #include "net/url_request/url_request_status.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 #include "url/origin.h" |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
29 } // namespace base | 30 } // namespace base |
30 | 31 |
31 namespace net { | 32 namespace net { |
32 class DrainableIOBuffer; | 33 class DrainableIOBuffer; |
33 class HttpResponseHeaders; | 34 class HttpResponseHeaders; |
34 class IOBuffer; | 35 class IOBuffer; |
35 class URLFetcherDelegate; | 36 class URLFetcherDelegate; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void SetLoadFlags(int load_flags); | 82 void SetLoadFlags(int load_flags); |
82 int GetLoadFlags() const; | 83 int GetLoadFlags() const; |
83 void SetReferrer(const std::string& referrer); | 84 void SetReferrer(const std::string& referrer); |
84 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy); | 85 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy); |
85 void SetExtraRequestHeaders(const std::string& extra_request_headers); | 86 void SetExtraRequestHeaders(const std::string& extra_request_headers); |
86 void AddExtraRequestHeader(const std::string& header_line); | 87 void AddExtraRequestHeader(const std::string& header_line); |
87 void SetRequestContext(URLRequestContextGetter* request_context_getter); | 88 void SetRequestContext(URLRequestContextGetter* request_context_getter); |
88 // Set the URL that should be consulted for the third-party cookie | 89 // Set the URL that should be consulted for the third-party cookie |
89 // blocking policy. | 90 // blocking policy. |
90 void SetFirstPartyForCookies(const GURL& first_party_for_cookies); | 91 void SetFirstPartyForCookies(const GURL& first_party_for_cookies); |
| 92 void SetRequestorOrigin(const url::Origin& requestor_origin); |
91 // Set the key and data callback that is used when setting the user | 93 // Set the key and data callback that is used when setting the user |
92 // data on any URLRequest objects this object creates. | 94 // data on any URLRequest objects this object creates. |
93 void SetURLRequestUserData( | 95 void SetURLRequestUserData( |
94 const void* key, | 96 const void* key, |
95 const URLFetcher::CreateDataCallback& create_data_callback); | 97 const URLFetcher::CreateDataCallback& create_data_callback); |
96 void SetStopOnRedirect(bool stop_on_redirect); | 98 void SetStopOnRedirect(bool stop_on_redirect); |
97 void SetAutomaticallyRetryOn5xx(bool retry); | 99 void SetAutomaticallyRetryOn5xx(bool retry); |
98 void SetMaxRetriesOn5xx(int max_retries); | 100 void SetMaxRetriesOn5xx(int max_retries); |
99 int GetMaxRetriesOn5xx() const; | 101 int GetMaxRetriesOn5xx() const; |
100 base::TimeDelta GetBackoffDelay() const; | 102 base::TimeDelta GetBackoffDelay() const; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Task runner for upload file access. | 233 // Task runner for upload file access. |
232 scoped_refptr<base::TaskRunner> upload_file_task_runner_; | 234 scoped_refptr<base::TaskRunner> upload_file_task_runner_; |
233 scoped_ptr<URLRequest> request_; // The actual request this wraps | 235 scoped_ptr<URLRequest> request_; // The actual request this wraps |
234 int load_flags_; // Flags for the load operation | 236 int load_flags_; // Flags for the load operation |
235 int response_code_; // HTTP status code for the request | 237 int response_code_; // HTTP status code for the request |
236 scoped_refptr<IOBuffer> buffer_; | 238 scoped_refptr<IOBuffer> buffer_; |
237 // Read buffer | 239 // Read buffer |
238 scoped_refptr<URLRequestContextGetter> request_context_getter_; | 240 scoped_refptr<URLRequestContextGetter> request_context_getter_; |
239 // Cookie/cache info for the request | 241 // Cookie/cache info for the request |
240 GURL first_party_for_cookies_; // The first party URL for the request | 242 GURL first_party_for_cookies_; // The first party URL for the request |
| 243 url::Origin requestor_origin_; // The origin responsible for the request. |
241 // The user data to add to each newly-created URLRequest. | 244 // The user data to add to each newly-created URLRequest. |
242 const void* url_request_data_key_; | 245 const void* url_request_data_key_; |
243 URLFetcher::CreateDataCallback url_request_create_data_callback_; | 246 URLFetcher::CreateDataCallback url_request_create_data_callback_; |
244 ResponseCookies cookies_; // Response cookies | 247 ResponseCookies cookies_; // Response cookies |
245 HttpRequestHeaders extra_request_headers_; | 248 HttpRequestHeaders extra_request_headers_; |
246 scoped_refptr<HttpResponseHeaders> response_headers_; | 249 scoped_refptr<HttpResponseHeaders> response_headers_; |
247 bool was_fetched_via_proxy_; | 250 bool was_fetched_via_proxy_; |
248 HostPortPair socket_address_; | 251 HostPortPair socket_address_; |
249 | 252 |
250 bool upload_content_set_; // SetUploadData has been called | 253 bool upload_content_set_; // SetUploadData has been called |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 base::debug::StackTrace stack_trace_; | 334 base::debug::StackTrace stack_trace_; |
332 | 335 |
333 static base::LazyInstance<Registry> g_registry; | 336 static base::LazyInstance<Registry> g_registry; |
334 | 337 |
335 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 338 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
336 }; | 339 }; |
337 | 340 |
338 } // namespace net | 341 } // namespace net |
339 | 342 |
340 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 343 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
OLD | NEW |