Chromium Code Reviews| 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 } | 186 } |
| 187 | 187 |
| 188 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { | 188 ResourceRequestInfoImpl* ResourceLoader::GetRequestInfo() { |
| 189 return ResourceRequestInfoImpl::ForRequest(request_.get()); | 189 return ResourceRequestInfoImpl::ForRequest(request_.get()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void ResourceLoader::ClearLoginDelegate() { | 192 void ResourceLoader::ClearLoginDelegate() { |
| 193 login_delegate_ = NULL; | 193 login_delegate_ = NULL; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void ResourceLoader::ClearSSLClientAuthHandler() { | |
| 197 ssl_client_auth_handler_ = NULL; | |
| 198 } | |
| 199 | |
| 200 void ResourceLoader::OnUploadProgressACK() { | 196 void ResourceLoader::OnUploadProgressACK() { |
| 201 waiting_for_upload_progress_ack_ = false; | 197 waiting_for_upload_progress_ack_ = false; |
| 202 } | 198 } |
| 203 | 199 |
| 204 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, | 200 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, |
| 205 const net::RedirectInfo& redirect_info, | 201 const net::RedirectInfo& redirect_info, |
| 206 bool* defer) { | 202 bool* defer) { |
| 207 DCHECK_EQ(request_.get(), unused); | 203 DCHECK_EQ(request_.get(), unused); |
| 208 | 204 |
| 209 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); | 205 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 if (request_->load_flags() & net::LOAD_PREFETCH) { | 263 if (request_->load_flags() & net::LOAD_PREFETCH) { |
| 268 request_->Cancel(); | 264 request_->Cancel(); |
| 269 return; | 265 return; |
| 270 } | 266 } |
| 271 | 267 |
| 272 DCHECK(!ssl_client_auth_handler_.get()) | 268 DCHECK(!ssl_client_auth_handler_.get()) |
| 273 << "OnCertificateRequested called with ssl_client_auth_handler pending"; | 269 << "OnCertificateRequested called with ssl_client_auth_handler pending"; |
| 274 ssl_client_auth_handler_ = new SSLClientAuthHandler( | 270 ssl_client_auth_handler_ = new SSLClientAuthHandler( |
| 275 GetRequestInfo()->GetContext()->CreateClientCertStore(), | 271 GetRequestInfo()->GetContext()->CreateClientCertStore(), |
| 276 request_.get(), | 272 request_.get(), |
| 277 cert_info); | 273 cert_info, |
| 274 base::Bind(&ResourceLoader::ContinueWithCertificate, | |
| 275 weak_ptr_factory_.GetWeakPtr())); | |
| 278 ssl_client_auth_handler_->SelectCertificate(); | 276 ssl_client_auth_handler_->SelectCertificate(); |
| 279 } | 277 } |
| 280 | 278 |
| 281 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, | 279 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, |
| 282 const net::SSLInfo& ssl_info, | 280 const net::SSLInfo& ssl_info, |
| 283 bool fatal) { | 281 bool fatal) { |
| 284 ResourceRequestInfoImpl* info = GetRequestInfo(); | 282 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 285 | 283 |
| 286 int render_process_id; | 284 int render_process_id; |
| 287 int render_frame_id; | 285 int render_frame_id; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 case net::URLRequestStatus::IO_PENDING: | 703 case net::URLRequestStatus::IO_PENDING: |
| 706 case net::URLRequestStatus::FAILED: | 704 case net::URLRequestStatus::FAILED: |
| 707 status = STATUS_UNDEFINED; | 705 status = STATUS_UNDEFINED; |
| 708 break; | 706 break; |
| 709 } | 707 } |
| 710 | 708 |
| 711 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 709 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 712 } | 710 } |
| 713 } | 711 } |
| 714 | 712 |
| 713 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | |
| 714 request_->ContinueWithCertificate(cert); | |
| 715 ssl_client_auth_handler_ = NULL; | |
|
mmenke
2014/09/23 19:24:23
Should we clear the auth handler first?
Hrm...I'm
davidben
2014/09/23 21:22:02
Done. Yeah, that's probably better; just in case e
| |
| 716 } | |
| 717 | |
| 715 } // namespace content | 718 } // namespace content |
| OLD | NEW |