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