| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( | 256 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( |
| 257 StatisticSelector statistic) const { | 257 StatisticSelector statistic) const { |
| 258 job_->RecordPacketStats(statistic); | 258 job_->RecordPacketStats(statistic); |
| 259 } | 259 } |
| 260 | 260 |
| 261 const NetLogWithSource& URLRequestHttpJob::HttpFilterContext::GetNetLog() | 261 const NetLogWithSource& URLRequestHttpJob::HttpFilterContext::GetNetLog() |
| 262 const { | 262 const { |
| 263 return job_->request() ? job_->request()->net_log() : dummy_log_; | 263 return job_->request() ? job_->request()->net_log() : dummy_log_; |
| 264 } | 264 } |
| 265 | 265 |
| 266 // TODO(darin): make sure the port blocking code is not lost | |
| 267 // static | |
| 268 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, | |
| 269 NetworkDelegate* network_delegate, | |
| 270 const std::string& scheme) { | |
| 271 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" || | |
| 272 scheme == "wss"); | |
| 273 | |
| 274 if (!request->context()->http_transaction_factory()) { | |
| 275 NOTREACHED() << "requires a valid context"; | |
| 276 return new URLRequestErrorJob( | |
| 277 request, network_delegate, ERR_INVALID_ARGUMENT); | |
| 278 } | |
| 279 | |
| 280 URLRequestRedirectJob* redirect = | |
| 281 MaybeInternallyRedirect(request, network_delegate); | |
| 282 if (redirect) | |
| 283 return redirect; | |
| 284 | |
| 285 return new URLRequestHttpJob(request, | |
| 286 network_delegate, | |
| 287 request->context()->http_user_agent_settings()); | |
| 288 } | |
| 289 | |
| 290 URLRequestHttpJob::URLRequestHttpJob( | 266 URLRequestHttpJob::URLRequestHttpJob( |
| 291 URLRequest* request, | 267 URLRequest* request, |
| 292 NetworkDelegate* network_delegate, | 268 NetworkDelegate* network_delegate, |
| 293 const HttpUserAgentSettings* http_user_agent_settings) | 269 const HttpUserAgentSettings* http_user_agent_settings) |
| 294 : URLRequestJob(request, network_delegate), | 270 : URLRequestJob(request, network_delegate), |
| 295 priority_(DEFAULT_PRIORITY), | 271 priority_(DEFAULT_PRIORITY), |
| 296 response_info_(nullptr), | 272 response_info_(nullptr), |
| 297 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 273 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 298 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 274 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 299 start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted, | 275 start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 // Notify NetworkQualityEstimator. | 1569 // Notify NetworkQualityEstimator. |
| 1594 if (request()) { | 1570 if (request()) { |
| 1595 NetworkQualityEstimator* network_quality_estimator = | 1571 NetworkQualityEstimator* network_quality_estimator = |
| 1596 request()->context()->network_quality_estimator(); | 1572 request()->context()->network_quality_estimator(); |
| 1597 if (network_quality_estimator) | 1573 if (network_quality_estimator) |
| 1598 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1574 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1599 } | 1575 } |
| 1600 } | 1576 } |
| 1601 | 1577 |
| 1602 } // namespace net | 1578 } // namespace net |
| OLD | NEW |