| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "base/system_monitor/system_monitor.h" |
| 15 #include "base/task.h" | 16 #include "base/task.h" |
| 16 #include "base/time.h" | 17 #include "base/time.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/filter.h" | 19 #include "net/base/filter.h" |
| 19 #include "net/base/host_port_pair.h" | 20 #include "net/base/host_port_pair.h" |
| 20 #include "net/base/load_states.h" | 21 #include "net/base/load_states.h" |
| 21 #include "net/base/net_api.h" | 22 #include "net/base/net_api.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class AuthChallengeInfo; | 26 class AuthChallengeInfo; |
| 26 class HttpRequestHeaders; | 27 class HttpRequestHeaders; |
| 27 class HttpResponseInfo; | 28 class HttpResponseInfo; |
| 28 class IOBuffer; | 29 class IOBuffer; |
| 29 class URLRequest; | 30 class URLRequest; |
| 30 class UploadData; | 31 class UploadData; |
| 31 class URLRequestStatus; | 32 class URLRequestStatus; |
| 32 class X509Certificate; | 33 class X509Certificate; |
| 33 | 34 |
| 34 class NET_API URLRequestJob : public base::RefCounted<URLRequestJob> { | 35 class NET_API URLRequestJob : public base::RefCounted<URLRequestJob>, |
| 36 public base::SystemMonitor::PowerObserver { |
| 35 public: | 37 public: |
| 36 explicit URLRequestJob(URLRequest* request); | 38 explicit URLRequestJob(URLRequest* request); |
| 37 | 39 |
| 38 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the | 40 // Returns the request that owns this job. THIS POINTER MAY BE NULL if the |
| 39 // request was destroyed. | 41 // request was destroyed. |
| 40 URLRequest* request() const { | 42 URLRequest* request() const { |
| 41 return request_; | 43 return request_; |
| 42 } | 44 } |
| 43 | 45 |
| 44 // Sets the upload data, most requests have no upload data, so this is a NOP. | 46 // Sets the upload data, most requests have no upload data, so this is a NOP. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 bool has_response_started() const { return has_handled_response_; } | 175 bool has_response_started() const { return has_handled_response_; } |
| 174 | 176 |
| 175 // These methods are not applicable to all connections. | 177 // These methods are not applicable to all connections. |
| 176 virtual bool GetMimeType(std::string* mime_type) const; | 178 virtual bool GetMimeType(std::string* mime_type) const; |
| 177 virtual int GetResponseCode() const; | 179 virtual int GetResponseCode() const; |
| 178 | 180 |
| 179 // Returns the socket address for the connection. | 181 // Returns the socket address for the connection. |
| 180 // See url_request.h for details. | 182 // See url_request.h for details. |
| 181 virtual HostPortPair GetSocketAddress() const; | 183 virtual HostPortPair GetSocketAddress() const; |
| 182 | 184 |
| 185 // base::SystemMonitor::PowerObserver methods: |
| 186 // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). |
| 187 virtual void OnSuspend(); |
| 188 |
| 183 protected: | 189 protected: |
| 184 friend class base::RefCounted<URLRequestJob>; | 190 friend class base::RefCounted<URLRequestJob>; |
| 185 virtual ~URLRequestJob(); | 191 virtual ~URLRequestJob(); |
| 186 | 192 |
| 187 // Notifies the job that headers have been received. | 193 // Notifies the job that headers have been received. |
| 188 void NotifyHeadersComplete(); | 194 void NotifyHeadersComplete(); |
| 189 | 195 |
| 190 // Notifies the request that the job has completed a Read operation. | 196 // Notifies the request that the job has completed a Read operation. |
| 191 void NotifyReadComplete(int bytes_read); | 197 void NotifyReadComplete(int bytes_read); |
| 192 | 198 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 int deferred_redirect_status_code_; | 342 int deferred_redirect_status_code_; |
| 337 | 343 |
| 338 ScopedRunnableMethodFactory<URLRequestJob> method_factory_; | 344 ScopedRunnableMethodFactory<URLRequestJob> method_factory_; |
| 339 | 345 |
| 340 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 346 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 341 }; | 347 }; |
| 342 | 348 |
| 343 } // namespace net | 349 } // namespace net |
| 344 | 350 |
| 345 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 351 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| OLD | NEW |