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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/common/content_client.h" | 30 #include "content/public/common/content_client.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/resource_response.h" | 32 #include "content/public/common/resource_response.h" |
33 #include "content/public/common/resource_type.h" | 33 #include "content/public/common/resource_type.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/nqe/effective_connection_type.h" | 37 #include "net/nqe/effective_connection_type.h" |
38 #include "net/nqe/network_quality_estimator.h" | 38 #include "net/nqe/network_quality_estimator.h" |
39 #include "net/ssl/client_cert_store.h" | 39 #include "net/ssl/client_cert_store.h" |
40 #include "net/ssl/ssl_platform_key.h" | |
41 #include "net/ssl/ssl_private_key.h" | |
42 #include "net/url_request/redirect_info.h" | 40 #include "net/url_request/redirect_info.h" |
43 #include "net/url_request/url_request_context.h" | 41 #include "net/url_request/url_request_context.h" |
44 #include "net/url_request/url_request_status.h" | 42 #include "net/url_request/url_request_status.h" |
45 | 43 |
46 using base::TimeDelta; | 44 using base::TimeDelta; |
47 using base::TimeTicks; | 45 using base::TimeTicks; |
48 | 46 |
49 namespace content { | 47 namespace content { |
50 namespace { | 48 namespace { |
51 | 49 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 460 } |
463 | 461 |
464 void ResourceLoader::ContinueSSLRequest() { | 462 void ResourceLoader::ContinueSSLRequest() { |
465 DCHECK(thread_checker_.CalledOnValidThread()); | 463 DCHECK(thread_checker_.CalledOnValidThread()); |
466 | 464 |
467 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); | 465 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); |
468 | 466 |
469 request_->ContinueDespiteLastError(); | 467 request_->ContinueDespiteLastError(); |
470 } | 468 } |
471 | 469 |
472 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | 470 void ResourceLoader::ContinueWithCertificate( |
| 471 scoped_refptr<net::X509Certificate> cert, |
| 472 scoped_refptr<net::SSLPrivateKey> private_key) { |
473 DCHECK(ssl_client_auth_handler_); | 473 DCHECK(ssl_client_auth_handler_); |
474 ssl_client_auth_handler_.reset(); | 474 ssl_client_auth_handler_.reset(); |
475 if (!cert) { | 475 request_->ContinueWithCertificate(std::move(cert), std::move(private_key)); |
476 request_->ContinueWithCertificate(nullptr, nullptr); | |
477 return; | |
478 } | |
479 scoped_refptr<net::SSLPrivateKey> private_key = | |
480 net::FetchClientCertPrivateKey(cert); | |
481 request_->ContinueWithCertificate(cert, private_key.get()); | |
482 } | 476 } |
483 | 477 |
484 void ResourceLoader::CancelCertificateSelection() { | 478 void ResourceLoader::CancelCertificateSelection() { |
485 DCHECK(ssl_client_auth_handler_); | 479 DCHECK(ssl_client_auth_handler_); |
486 ssl_client_auth_handler_.reset(); | 480 ssl_client_auth_handler_.reset(); |
487 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); | 481 request_->CancelWithError(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
488 } | 482 } |
489 | 483 |
490 void ResourceLoader::Resume(bool called_from_resource_controller) { | 484 void ResourceLoader::Resume(bool called_from_resource_controller) { |
491 DCHECK(!is_transferring_); | 485 DCHECK(!is_transferring_); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, | 811 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, |
818 STATUS_MAX); | 812 STATUS_MAX); |
819 } | 813 } |
820 } else if (request_->response_info().unused_since_prefetch) { | 814 } else if (request_->response_info().unused_since_prefetch) { |
821 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 815 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
822 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 816 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
823 } | 817 } |
824 } | 818 } |
825 | 819 |
826 } // namespace content | 820 } // namespace content |
OLD | NEW |