| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( | 164 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( |
| 165 StatisticSelector statistic) const { | 165 StatisticSelector statistic) const { |
| 166 job_->RecordPacketStats(statistic); | 166 job_->RecordPacketStats(statistic); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // TODO(darin): make sure the port blocking code is not lost | 169 // TODO(darin): make sure the port blocking code is not lost |
| 170 // static | 170 // static |
| 171 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, | 171 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, |
| 172 NetworkDelegate* network_delegate, |
| 172 const std::string& scheme) { | 173 const std::string& scheme) { |
| 173 DCHECK(scheme == "http" || scheme == "https"); | 174 DCHECK(scheme == "http" || scheme == "https"); |
| 174 | 175 |
| 175 if (!request->context()->http_transaction_factory()) { | 176 if (!request->context()->http_transaction_factory()) { |
| 176 NOTREACHED() << "requires a valid context"; | 177 NOTREACHED() << "requires a valid context"; |
| 177 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); | 178 return new URLRequestErrorJob( |
| 179 request, network_delegate, ERR_INVALID_ARGUMENT); |
| 178 } | 180 } |
| 179 | 181 |
| 180 GURL redirect_url; | 182 GURL redirect_url; |
| 181 if (request->GetHSTSRedirect(&redirect_url)) | 183 if (request->GetHSTSRedirect(&redirect_url)) |
| 182 return new URLRequestRedirectJob(request, redirect_url); | 184 return new URLRequestRedirectJob(request, network_delegate, redirect_url); |
| 183 return new URLRequestHttpJob(request); | 185 return new URLRequestHttpJob(request, network_delegate); |
| 184 } | 186 } |
| 185 | 187 |
| 186 | 188 |
| 187 URLRequestHttpJob::URLRequestHttpJob(URLRequest* request) | 189 URLRequestHttpJob::URLRequestHttpJob(URLRequest* request, |
| 188 : URLRequestJob(request, request->context()->network_delegate()), | 190 NetworkDelegate* network_delegate) |
| 191 : URLRequestJob(request, network_delegate), |
| 189 response_info_(NULL), | 192 response_info_(NULL), |
| 190 response_cookies_save_index_(0), | 193 response_cookies_save_index_(0), |
| 191 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 194 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 192 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 195 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 193 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( | 196 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( |
| 194 base::Bind(&URLRequestHttpJob::OnStartCompleted, | 197 base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 195 base::Unretained(this)))), | 198 base::Unretained(this)))), |
| 196 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( | 199 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( |
| 197 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, | 200 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, |
| 198 base::Unretained(this)))), | 201 base::Unretained(this)))), |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 | 1470 |
| 1468 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1471 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1469 awaiting_callback_ = false; | 1472 awaiting_callback_ = false; |
| 1470 } | 1473 } |
| 1471 | 1474 |
| 1472 void URLRequestHttpJob::OnDetachRequest() { | 1475 void URLRequestHttpJob::OnDetachRequest() { |
| 1473 http_transaction_delegate_->OnDetachRequest(); | 1476 http_transaction_delegate_->OnDetachRequest(); |
| 1474 } | 1477 } |
| 1475 | 1478 |
| 1476 } // namespace net | 1479 } // namespace net |
| OLD | NEW |