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