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/system_monitor/system_monitor.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/power_monitor/power_observer.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "net/base/filter.h" | 17 #include "net/base/filter.h" |
17 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
18 #include "net/base/load_states.h" | 19 #include "net/base/load_states.h" |
19 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
20 #include "net/base/upload_progress.h" | 21 #include "net/base/upload_progress.h" |
21 #include "net/cookies/canonical_cookie.h" | 22 #include "net/cookies/canonical_cookie.h" |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 | 25 |
25 class AuthChallengeInfo; | 26 class AuthChallengeInfo; |
26 class AuthCredentials; | 27 class AuthCredentials; |
27 class CookieOptions; | 28 class CookieOptions; |
28 class HttpRequestHeaders; | 29 class HttpRequestHeaders; |
29 class HttpResponseInfo; | 30 class HttpResponseInfo; |
30 class IOBuffer; | 31 class IOBuffer; |
31 struct LoadTimingInfo; | 32 struct LoadTimingInfo; |
32 class NetworkDelegate; | 33 class NetworkDelegate; |
33 class SSLCertRequestInfo; | 34 class SSLCertRequestInfo; |
34 class SSLInfo; | 35 class SSLInfo; |
35 class URLRequest; | 36 class URLRequest; |
36 class UploadDataStream; | 37 class UploadDataStream; |
37 class URLRequestStatus; | 38 class URLRequestStatus; |
38 class X509Certificate; | 39 class X509Certificate; |
39 | 40 |
40 class NET_EXPORT URLRequestJob : public base::RefCounted<URLRequestJob>, | 41 class NET_EXPORT URLRequestJob : public base::RefCounted<URLRequestJob>, |
41 public base::SystemMonitor::PowerObserver { | 42 public base::PowerObserver { |
42 public: | 43 public: |
43 explicit URLRequestJob(URLRequest* request, | 44 explicit URLRequestJob(URLRequest* request, |
44 NetworkDelegate* network_delegate); | 45 NetworkDelegate* network_delegate); |
45 | 46 |
46 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the | 47 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the |
47 // request was destroyed. | 48 // request was destroyed. |
48 URLRequest* request() const { | 49 URLRequest* request() const { |
49 return request_; | 50 return request_; |
50 } | 51 } |
51 | 52 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool has_response_started() const { return has_handled_response_; } | 183 bool has_response_started() const { return has_handled_response_; } |
183 | 184 |
184 // These methods are not applicable to all connections. | 185 // These methods are not applicable to all connections. |
185 virtual bool GetMimeType(std::string* mime_type) const; | 186 virtual bool GetMimeType(std::string* mime_type) const; |
186 virtual int GetResponseCode() const; | 187 virtual int GetResponseCode() const; |
187 | 188 |
188 // Returns the socket address for the connection. | 189 // Returns the socket address for the connection. |
189 // See url_request.h for details. | 190 // See url_request.h for details. |
190 virtual HostPortPair GetSocketAddress() const; | 191 virtual HostPortPair GetSocketAddress() const; |
191 | 192 |
192 // base::SystemMonitor::PowerObserver methods: | 193 // base::PowerObserver methods: |
193 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). | 194 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). |
194 virtual void OnSuspend() OVERRIDE; | 195 virtual void OnSuspend() OVERRIDE; |
195 | 196 |
196 // Called after a NetworkDelegate has been informed that the URLRequest | 197 // Called after a NetworkDelegate has been informed that the URLRequest |
197 // will be destroyed. This is used to track that no pending callbacks | 198 // will be destroyed. This is used to track that no pending callbacks |
198 // exist at destruction time of the URLRequestJob, unless they have been | 199 // exist at destruction time of the URLRequestJob, unless they have been |
199 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. | 200 // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. |
200 virtual void NotifyURLRequestDestroyed(); | 201 virtual void NotifyURLRequestDestroyed(); |
201 | 202 |
202 protected: | 203 protected: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 NetworkDelegate* network_delegate_; | 387 NetworkDelegate* network_delegate_; |
387 | 388 |
388 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 389 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
389 | 390 |
390 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 391 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
391 }; | 392 }; |
392 | 393 |
393 } // namespace net | 394 } // namespace net |
394 | 395 |
395 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 396 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |