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 #include "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( | 192 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( |
193 StatisticSelector statistic) const { | 193 StatisticSelector statistic) const { |
194 job_->RecordPacketStats(statistic); | 194 job_->RecordPacketStats(statistic); |
195 } | 195 } |
196 | 196 |
197 // TODO(darin): make sure the port blocking code is not lost | 197 // TODO(darin): make sure the port blocking code is not lost |
198 // static | 198 // static |
199 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, | 199 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, |
| 200 NetworkDelegate* network_delegate, |
200 const std::string& scheme) { | 201 const std::string& scheme) { |
201 DCHECK(scheme == "http" || scheme == "https"); | 202 DCHECK(scheme == "http" || scheme == "https"); |
202 | 203 |
203 if (!request->context()->http_transaction_factory()) { | 204 if (!request->context()->http_transaction_factory()) { |
204 NOTREACHED() << "requires a valid context"; | 205 NOTREACHED() << "requires a valid context"; |
205 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); | 206 return new URLRequestErrorJob( |
| 207 request, network_delegate, ERR_INVALID_ARGUMENT); |
206 } | 208 } |
207 | 209 |
208 GURL redirect_url; | 210 GURL redirect_url; |
209 if (request->GetHSTSRedirect(&redirect_url)) | 211 if (request->GetHSTSRedirect(&redirect_url)) |
210 return new URLRequestRedirectJob(request, redirect_url); | 212 return new URLRequestRedirectJob(request, network_delegate, redirect_url); |
211 return new URLRequestHttpJob(request); | 213 return new URLRequestHttpJob(request, network_delegate); |
212 } | 214 } |
213 | 215 |
214 | 216 |
215 URLRequestHttpJob::URLRequestHttpJob(URLRequest* request) | 217 URLRequestHttpJob::URLRequestHttpJob(URLRequest* request, |
216 : URLRequestJob(request, request->context()->network_delegate()), | 218 NetworkDelegate* network_delegate) |
| 219 : URLRequestJob(request, network_delegate), |
217 response_info_(NULL), | 220 response_info_(NULL), |
218 response_cookies_save_index_(0), | 221 response_cookies_save_index_(0), |
219 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 222 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
220 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 223 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
221 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( | 224 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( |
222 base::Bind(&URLRequestHttpJob::OnStartCompleted, | 225 base::Bind(&URLRequestHttpJob::OnStartCompleted, |
223 base::Unretained(this)))), | 226 base::Unretained(this)))), |
224 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( | 227 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( |
225 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, | 228 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, |
226 base::Unretained(this)))), | 229 base::Unretained(this)))), |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 | 1500 |
1498 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1501 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
1499 awaiting_callback_ = false; | 1502 awaiting_callback_ = false; |
1500 } | 1503 } |
1501 | 1504 |
1502 void URLRequestHttpJob::OnDetachRequest() { | 1505 void URLRequestHttpJob::OnDetachRequest() { |
1503 http_transaction_delegate_->OnDetachRequest(); | 1506 http_transaction_delegate_->OnDetachRequest(); |
1504 } | 1507 } |
1505 | 1508 |
1506 } // namespace net | 1509 } // namespace net |
OLD | NEW |