| 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/location.h" | 8 #include "base/location.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 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/browser/signed_certificate_timestamp_store.h" | 28 #include "content/public/browser/signed_certificate_timestamp_store.h" |
| 29 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "content/public/common/process_type.h" | 31 #include "content/public/common/process_type.h" |
| 32 #include "content/public/common/resource_response.h" | 32 #include "content/public/common/resource_response.h" |
| 33 #include "content/public/common/security_style.h" | 33 #include "content/public/common/security_style.h" |
| 34 #include "net/base/io_buffer.h" | 34 #include "net/base/io_buffer.h" |
| 35 #include "net/base/load_flags.h" | 35 #include "net/base/load_flags.h" |
| 36 #include "net/http/http_response_headers.h" | 36 #include "net/http/http_response_headers.h" |
| 37 #include "net/ssl/client_cert_store.h" | 37 #include "net/ssl/client_cert_store.h" |
| 38 #include "net/ssl/ssl_platform_key.h" |
| 39 #include "net/ssl/ssl_private_key.h" |
| 38 #include "net/url_request/redirect_info.h" | 40 #include "net/url_request/redirect_info.h" |
| 39 #include "net/url_request/url_request_status.h" | 41 #include "net/url_request/url_request_status.h" |
| 40 | 42 |
| 41 using base::TimeDelta; | 43 using base::TimeDelta; |
| 42 using base::TimeTicks; | 44 using base::TimeTicks; |
| 43 | 45 |
| 44 namespace content { | 46 namespace content { |
| 45 namespace { | 47 namespace { |
| 46 | 48 |
| 47 void StoreSignedCertificateTimestamps( | 49 void StoreSignedCertificateTimestamps( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 418 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 417 | 419 |
| 418 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); | 420 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); |
| 419 | 421 |
| 420 request_->ContinueDespiteLastError(); | 422 request_->ContinueDespiteLastError(); |
| 421 } | 423 } |
| 422 | 424 |
| 423 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | 425 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { |
| 424 DCHECK(ssl_client_auth_handler_); | 426 DCHECK(ssl_client_auth_handler_); |
| 425 ssl_client_auth_handler_.reset(); | 427 ssl_client_auth_handler_.reset(); |
| 426 request_->ContinueWithCertificate(cert); | 428 if (!cert) { |
| 429 request_->ContinueWithCertificate(nullptr, nullptr); |
| 430 return; |
| 431 } |
| 432 scoped_refptr<net::SSLPrivateKey> private_key = |
| 433 net::FetchClientCertPrivateKey(cert); |
| 434 request_->ContinueWithCertificate(cert, private_key.get()); |
| 427 } | 435 } |
| 428 | 436 |
| 429 void ResourceLoader::CancelCertificateSelection() { | 437 void ResourceLoader::CancelCertificateSelection() { |
| 430 DCHECK(ssl_client_auth_handler_); | 438 DCHECK(ssl_client_auth_handler_); |
| 431 ssl_client_auth_handler_.reset(); | 439 ssl_client_auth_handler_.reset(); |
| 432 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); | 440 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
| 433 } | 441 } |
| 434 | 442 |
| 435 void ResourceLoader::Resume() { | 443 void ResourceLoader::Resume() { |
| 436 DCHECK(!is_transferring_); | 444 DCHECK(!is_transferring_); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 case net::URLRequestStatus::FAILED: | 715 case net::URLRequestStatus::FAILED: |
| 708 status = STATUS_UNDEFINED; | 716 status = STATUS_UNDEFINED; |
| 709 break; | 717 break; |
| 710 } | 718 } |
| 711 | 719 |
| 712 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 720 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 713 } | 721 } |
| 714 } | 722 } |
| 715 | 723 |
| 716 } // namespace content | 724 } // namespace content |
| OLD | NEW |