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_REQUEST_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/power_monitor/power_observer.h" | 15 #include "base/power_monitor/power_observer.h" |
16 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
17 #include "net/base/load_states.h" | 17 #include "net/base/load_states.h" |
18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
19 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
20 #include "net/base/upload_progress.h" | 20 #include "net/base/upload_progress.h" |
21 #include "net/cookies/canonical_cookie.h" | 21 #include "net/cookies/canonical_cookie.h" |
22 #include "net/url_request/redirect_info.h" | 22 #include "net/url_request/redirect_info.h" |
| 23 #include "net/url_request/url_request.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 | 27 |
27 class AuthChallengeInfo; | 28 class AuthChallengeInfo; |
28 class AuthCredentials; | 29 class AuthCredentials; |
29 class CookieOptions; | 30 class CookieOptions; |
30 class CookieStore; | 31 class CookieStore; |
31 class Filter; | 32 class Filter; |
32 class HttpRequestHeaders; | 33 class HttpRequestHeaders; |
33 class HttpResponseInfo; | 34 class HttpResponseInfo; |
34 class IOBuffer; | 35 class IOBuffer; |
35 struct LoadTimingInfo; | 36 struct LoadTimingInfo; |
36 class NetworkDelegate; | 37 class NetworkDelegate; |
37 class SSLCertRequestInfo; | 38 class SSLCertRequestInfo; |
38 class SSLInfo; | 39 class SSLInfo; |
39 class URLRequest; | |
40 class UploadDataStream; | 40 class UploadDataStream; |
41 class URLRequestStatus; | 41 class URLRequestStatus; |
42 class X509Certificate; | 42 class X509Certificate; |
43 | 43 |
44 class NET_EXPORT URLRequestJob | 44 class NET_EXPORT URLRequestJob |
45 : public base::RefCounted<URLRequestJob>, | 45 : public base::RefCounted<URLRequestJob>, |
46 public base::PowerObserver { | 46 public base::PowerObserver { |
47 public: | 47 public: |
48 explicit URLRequestJob(URLRequest* request, | 48 explicit URLRequestJob(URLRequest* request, |
49 NetworkDelegate* network_delegate); | 49 NetworkDelegate* network_delegate); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // base::PowerObserver methods: | 220 // base::PowerObserver methods: |
221 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). | 221 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). |
222 void OnSuspend() override; | 222 void OnSuspend() override; |
223 | 223 |
224 // Called after a NetworkDelegate has been informed that the URLRequest | 224 // Called after a NetworkDelegate has been informed that the URLRequest |
225 // will be destroyed. This is used to track that no pending callbacks | 225 // will be destroyed. This is used to track that no pending callbacks |
226 // exist at destruction time of the URLRequestJob, unless they have been | 226 // exist at destruction time of the URLRequestJob, unless they have been |
227 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. | 227 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. |
228 virtual void NotifyURLRequestDestroyed(); | 228 virtual void NotifyURLRequestDestroyed(); |
229 | 229 |
| 230 // Given |policy|, |referrer|, and |redirect_destination|, returns the |
| 231 // referrer URL mandated by |request|'s referrer policy. |
| 232 static GURL ComputeReferrerForRedirect(URLRequest::ReferrerPolicy policy, |
| 233 const std::string& referrer, |
| 234 const GURL& redirect_destination); |
| 235 |
230 protected: | 236 protected: |
231 friend class base::RefCounted<URLRequestJob>; | 237 friend class base::RefCounted<URLRequestJob>; |
232 ~URLRequestJob() override; | 238 ~URLRequestJob() override; |
233 | 239 |
234 // Notifies the job that a certificate is requested. | 240 // Notifies the job that a certificate is requested. |
235 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); | 241 void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info); |
236 | 242 |
237 // Notifies the job about an SSL certificate error. | 243 // Notifies the job about an SSL certificate error. |
238 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal); | 244 void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal); |
239 | 245 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 NetworkDelegate* network_delegate_; | 436 NetworkDelegate* network_delegate_; |
431 | 437 |
432 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 438 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
433 | 439 |
434 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 440 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
435 }; | 441 }; |
436 | 442 |
437 } // namespace net | 443 } // namespace net |
438 | 444 |
439 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 445 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |