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