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/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 if (request_->load_flags() & net::LOAD_PREFETCH) { | 310 if (request_->load_flags() & net::LOAD_PREFETCH) { |
311 request_->Cancel(); | 311 request_->Cancel(); |
312 return; | 312 return; |
313 } | 313 } |
314 | 314 |
315 DCHECK(!ssl_client_auth_handler_) | 315 DCHECK(!ssl_client_auth_handler_) |
316 << "OnCertificateRequested called with ssl_client_auth_handler pending"; | 316 << "OnCertificateRequested called with ssl_client_auth_handler pending"; |
317 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( | 317 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( |
318 GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(), | 318 GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(), |
319 cert_info, base::Bind(&ResourceLoader::ContinueWithCertificate, | 319 cert_info, this)); |
320 weak_ptr_factory_.GetWeakPtr()))); | |
321 ssl_client_auth_handler_->SelectCertificate(); | 320 ssl_client_auth_handler_->SelectCertificate(); |
322 } | 321 } |
323 | 322 |
324 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, | 323 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, |
325 const net::SSLInfo& ssl_info, | 324 const net::SSLInfo& ssl_info, |
326 bool fatal) { | 325 bool fatal) { |
327 ResourceRequestInfoImpl* info = GetRequestInfo(); | 326 ResourceRequestInfoImpl* info = GetRequestInfo(); |
328 | 327 |
329 int render_process_id; | 328 int render_process_id; |
330 int render_frame_id; | 329 int render_frame_id; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 500 } |
502 | 501 |
503 void ResourceLoader::ContinueSSLRequest() { | 502 void ResourceLoader::ContinueSSLRequest() { |
504 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 503 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
505 | 504 |
506 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); | 505 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); |
507 | 506 |
508 request_->ContinueDespiteLastError(); | 507 request_->ContinueDespiteLastError(); |
509 } | 508 } |
510 | 509 |
| 510 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { |
| 511 DCHECK(ssl_client_auth_handler_); |
| 512 ssl_client_auth_handler_.reset(); |
| 513 request_->ContinueWithCertificate(cert); |
| 514 } |
| 515 |
| 516 void ResourceLoader::CancelCertificateSelection() { |
| 517 DCHECK(ssl_client_auth_handler_); |
| 518 ssl_client_auth_handler_.reset(); |
| 519 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
| 520 } |
| 521 |
511 void ResourceLoader::Resume() { | 522 void ResourceLoader::Resume() { |
512 DCHECK(!is_transferring_); | 523 DCHECK(!is_transferring_); |
513 | 524 |
514 DeferredStage stage = deferred_stage_; | 525 DeferredStage stage = deferred_stage_; |
515 deferred_stage_ = DEFERRED_NONE; | 526 deferred_stage_ = DEFERRED_NONE; |
516 switch (stage) { | 527 switch (stage) { |
517 case DEFERRED_NONE: | 528 case DEFERRED_NONE: |
518 NOTREACHED(); | 529 NOTREACHED(); |
519 break; | 530 break; |
520 case DEFERRED_START: | 531 case DEFERRED_START: |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 case net::URLRequestStatus::IO_PENDING: | 860 case net::URLRequestStatus::IO_PENDING: |
850 case net::URLRequestStatus::FAILED: | 861 case net::URLRequestStatus::FAILED: |
851 status = STATUS_UNDEFINED; | 862 status = STATUS_UNDEFINED; |
852 break; | 863 break; |
853 } | 864 } |
854 | 865 |
855 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 866 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
856 } | 867 } |
857 } | 868 } |
858 | 869 |
859 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | |
860 ssl_client_auth_handler_.reset(); | |
861 request_->ContinueWithCertificate(cert); | |
862 } | |
863 | |
864 } // namespace content | 870 } // namespace content |
OLD | NEW |