| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "content/browser/appcache/appcache_interceptor.h" | 17 #include "content/browser/appcache/appcache_interceptor.h" |
| 18 #include "content/browser/child_process_security_policy_impl.h" | 18 #include "content/browser/child_process_security_policy_impl.h" |
| 19 #include "content/browser/loader/cross_site_resource_handler.h" | 19 #include "content/browser/loader/cross_site_resource_handler.h" |
| 20 #include "content/browser/loader/detachable_resource_handler.h" | 20 #include "content/browser/loader/detachable_resource_handler.h" |
| 21 #include "content/browser/loader/resource_loader_delegate.h" | 21 #include "content/browser/loader/resource_loader_delegate.h" |
| 22 #include "content/browser/loader/resource_request_info_impl.h" | 22 #include "content/browser/loader/resource_request_info_impl.h" |
| 23 #include "content/browser/service_worker/service_worker_request_handler.h" | 23 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 24 #include "content/browser/service_worker/service_worker_response_info.h" | 24 #include "content/browser/service_worker/service_worker_response_info.h" |
| 25 #include "content/browser/ssl/ssl_client_auth_handler.h" | 25 #include "content/browser/ssl/ssl_client_auth_handler.h" |
| 26 #include "content/browser/ssl/ssl_manager.h" | 26 #include "content/browser/ssl/ssl_manager.h" |
| 27 #include "content/browser/ssl/ssl_policy.h" | 27 #include "content/browser/ssl/ssl_policy.h" |
| 28 #include "content/common/ssl_status_serialization.h" | 28 #include "content/common/ssl_status_serialization.h" |
| 29 #include "content/public/browser/cert_store.h" | 29 #include "content/public/browser/cert_store.h" |
| 30 #include "content/public/browser/resource_context.h" | |
| 31 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 30 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
| 32 #include "content/public/common/content_client.h" | 31 #include "content/public/common/content_client.h" |
| 33 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 34 #include "content/public/common/process_type.h" | 33 #include "content/public/common/process_type.h" |
| 35 #include "content/public/common/resource_response.h" | 34 #include "content/public/common/resource_response.h" |
| 36 #include "content/public/common/security_style.h" | 35 #include "content/public/common/security_style.h" |
| 37 #include "net/base/io_buffer.h" | 36 #include "net/base/io_buffer.h" |
| 38 #include "net/base/load_flags.h" | 37 #include "net/base/load_flags.h" |
| 39 #include "net/http/http_response_headers.h" | 38 #include "net/http/http_response_headers.h" |
| 40 #include "net/nqe/network_quality_estimator.h" | 39 #include "net/nqe/network_quality_estimator.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 DCHECK_EQ(request_.get(), unused); | 316 DCHECK_EQ(request_.get(), unused); |
| 318 | 317 |
| 319 if (request_->load_flags() & net::LOAD_PREFETCH) { | 318 if (request_->load_flags() & net::LOAD_PREFETCH) { |
| 320 request_->Cancel(); | 319 request_->Cancel(); |
| 321 return; | 320 return; |
| 322 } | 321 } |
| 323 | 322 |
| 324 DCHECK(!ssl_client_auth_handler_) | 323 DCHECK(!ssl_client_auth_handler_) |
| 325 << "OnCertificateRequested called with ssl_client_auth_handler pending"; | 324 << "OnCertificateRequested called with ssl_client_auth_handler pending"; |
| 326 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( | 325 ssl_client_auth_handler_.reset(new SSLClientAuthHandler( |
| 327 GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(), | 326 delegate_->CreateClientCertStore(this), request_.get(), cert_info, this)); |
| 328 cert_info, this)); | |
| 329 ssl_client_auth_handler_->SelectCertificate(); | 327 ssl_client_auth_handler_->SelectCertificate(); |
| 330 } | 328 } |
| 331 | 329 |
| 332 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, | 330 void ResourceLoader::OnSSLCertificateError(net::URLRequest* request, |
| 333 const net::SSLInfo& ssl_info, | 331 const net::SSLInfo& ssl_info, |
| 334 bool fatal) { | 332 bool fatal) { |
| 335 ResourceRequestInfoImpl* info = GetRequestInfo(); | 333 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 336 | 334 |
| 337 SSLManager::OnSSLCertificateError( | 335 SSLManager::OnSSLCertificateError( |
| 338 weak_ptr_factory_.GetWeakPtr(), info->GetResourceType(), request_->url(), | 336 weak_ptr_factory_.GetWeakPtr(), info->GetResourceType(), request_->url(), |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 744 } |
| 747 | 745 |
| 748 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 746 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 749 } else if (request_->response_info().unused_since_prefetch) { | 747 } else if (request_->response_info().unused_since_prefetch) { |
| 750 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 748 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
| 751 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 749 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
| 752 } | 750 } |
| 753 } | 751 } |
| 754 | 752 |
| 755 } // namespace content | 753 } // namespace content |
| OLD | NEW |