| 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_HTTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.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/time.h" | 14 #include "base/time.h" |
| 15 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/net_export.h" |
| 17 #include "net/cookies/cookie_store.h" | 18 #include "net/cookies/cookie_store.h" |
| 18 #include "net/http/http_request_info.h" | 19 #include "net/http/http_request_info.h" |
| 19 #include "net/url_request/url_request_job.h" | 20 #include "net/url_request/url_request_job.h" |
| 20 #include "net/url_request/url_request_throttler_entry_interface.h" | 21 #include "net/url_request/url_request_throttler_entry_interface.h" |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 | 24 |
| 24 class HttpResponseHeaders; | 25 class HttpResponseHeaders; |
| 25 class HttpResponseInfo; | 26 class HttpResponseInfo; |
| 26 class HttpTransaction; | 27 class HttpTransaction; |
| 27 class HttpUserAgentSettings; | 28 class HttpUserAgentSettings; |
| 28 class UploadDataStream; | 29 class UploadDataStream; |
| 29 class URLRequestContext; | 30 class URLRequestContext; |
| 30 | 31 |
| 31 // A URLRequestJob subclass that is built on top of HttpTransaction. It | 32 // A URLRequestJob subclass that is built on top of HttpTransaction. It |
| 32 // provides an implementation for both HTTP and HTTPS. | 33 // provides an implementation for both HTTP and HTTPS. |
| 33 class URLRequestHttpJob : public URLRequestJob { | 34 class NET_EXPORT_PRIVATE URLRequestHttpJob : public URLRequestJob { |
| 34 public: | 35 public: |
| 35 static URLRequestJob* Factory(URLRequest* request, | 36 static URLRequestJob* Factory(URLRequest* request, |
| 36 NetworkDelegate* network_delegate, | 37 NetworkDelegate* network_delegate, |
| 37 const std::string& scheme); | 38 const std::string& scheme); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 URLRequestHttpJob(URLRequest* request, | 41 URLRequestHttpJob(URLRequest* request, |
| 41 NetworkDelegate* network_delegate, | 42 NetworkDelegate* network_delegate, |
| 42 const HttpUserAgentSettings* http_user_agent_settings); | 43 const HttpUserAgentSettings* http_user_agent_settings); |
| 43 | 44 |
| 45 virtual ~URLRequestHttpJob(); |
| 46 |
| 44 // Shadows URLRequestJob's version of this method so we can grab cookies. | 47 // Shadows URLRequestJob's version of this method so we can grab cookies. |
| 45 void NotifyHeadersComplete(); | 48 void NotifyHeadersComplete(); |
| 46 | 49 |
| 47 // Shadows URLRequestJob's method so we can record histograms. | 50 // Shadows URLRequestJob's method so we can record histograms. |
| 48 void NotifyDone(const URLRequestStatus& status); | 51 void NotifyDone(const URLRequestStatus& status); |
| 49 | 52 |
| 50 void DestroyTransaction(); | 53 void DestroyTransaction(); |
| 51 | 54 |
| 52 void AddExtraHeaders(); | 55 void AddExtraHeaders(); |
| 53 void AddCookieHeaderAndStart(); | 56 void AddCookieHeaderAndStart(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; | 94 virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; |
| 92 virtual void CancelAuth() OVERRIDE; | 95 virtual void CancelAuth() OVERRIDE; |
| 93 virtual void ContinueWithCertificate(X509Certificate* client_cert) OVERRIDE; | 96 virtual void ContinueWithCertificate(X509Certificate* client_cert) OVERRIDE; |
| 94 virtual void ContinueDespiteLastError() OVERRIDE; | 97 virtual void ContinueDespiteLastError() OVERRIDE; |
| 95 virtual bool ReadRawData(IOBuffer* buf, int buf_size, | 98 virtual bool ReadRawData(IOBuffer* buf, int buf_size, |
| 96 int* bytes_read) OVERRIDE; | 99 int* bytes_read) OVERRIDE; |
| 97 virtual void StopCaching() OVERRIDE; | 100 virtual void StopCaching() OVERRIDE; |
| 98 virtual void DoneReading() OVERRIDE; | 101 virtual void DoneReading() OVERRIDE; |
| 99 virtual HostPortPair GetSocketAddress() const OVERRIDE; | 102 virtual HostPortPair GetSocketAddress() const OVERRIDE; |
| 100 virtual void NotifyURLRequestDestroyed() OVERRIDE; | 103 virtual void NotifyURLRequestDestroyed() OVERRIDE; |
| 104 virtual void SetPriority(RequestPriority priority) OVERRIDE; |
| 101 | 105 |
| 102 HttpRequestInfo request_info_; | 106 HttpRequestInfo request_info_; |
| 103 const HttpResponseInfo* response_info_; | 107 const HttpResponseInfo* response_info_; |
| 104 | 108 |
| 105 std::vector<std::string> response_cookies_; | 109 std::vector<std::string> response_cookies_; |
| 106 size_t response_cookies_save_index_; | 110 size_t response_cookies_save_index_; |
| 107 base::Time response_date_; | 111 base::Time response_date_; |
| 108 | 112 |
| 109 // Auth states for proxy and origin server. | 113 // Auth states for proxy and origin server. |
| 110 AuthState proxy_auth_state_; | 114 AuthState proxy_auth_state_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 enum CompletionCause { | 148 enum CompletionCause { |
| 145 ABORTED, | 149 ABORTED, |
| 146 FINISHED | 150 FINISHED |
| 147 }; | 151 }; |
| 148 | 152 |
| 149 typedef base::RefCountedData<bool> SharedBoolean; | 153 typedef base::RefCountedData<bool> SharedBoolean; |
| 150 | 154 |
| 151 class HttpFilterContext; | 155 class HttpFilterContext; |
| 152 class HttpTransactionDelegateImpl; | 156 class HttpTransactionDelegateImpl; |
| 153 | 157 |
| 154 virtual ~URLRequestHttpJob(); | |
| 155 | |
| 156 void RecordTimer(); | 158 void RecordTimer(); |
| 157 void ResetTimer(); | 159 void ResetTimer(); |
| 158 | 160 |
| 159 virtual void UpdatePacketReadTimes() OVERRIDE; | 161 virtual void UpdatePacketReadTimes() OVERRIDE; |
| 160 void RecordPacketStats(FilterContext::StatisticSelector statistic) const; | 162 void RecordPacketStats(FilterContext::StatisticSelector statistic) const; |
| 161 | 163 |
| 162 void RecordCompressionHistograms(); | 164 void RecordCompressionHistograms(); |
| 163 bool IsCompressibleContent() const; | 165 bool IsCompressibleContent() const; |
| 164 | 166 |
| 165 // Starts the transaction if extensions using the webrequest API do not | 167 // Starts the transaction if extensions using the webrequest API do not |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 scoped_ptr<HttpTransactionDelegateImpl> http_transaction_delegate_; | 251 scoped_ptr<HttpTransactionDelegateImpl> http_transaction_delegate_; |
| 250 | 252 |
| 251 const HttpUserAgentSettings* http_user_agent_settings_; | 253 const HttpUserAgentSettings* http_user_agent_settings_; |
| 252 | 254 |
| 253 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 255 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
| 254 }; | 256 }; |
| 255 | 257 |
| 256 } // namespace net | 258 } // namespace net |
| 257 | 259 |
| 258 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 260 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| OLD | NEW |