| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 DCHECK(!info->login_handler()) << | 962 DCHECK(!info->login_handler()) << |
| 963 "OnAuthRequired called with login_handler pending"; | 963 "OnAuthRequired called with login_handler pending"; |
| 964 info->set_login_handler(CreateLoginPrompt(auth_info, request)); | 964 info->set_login_handler(CreateLoginPrompt(auth_info, request)); |
| 965 } | 965 } |
| 966 | 966 |
| 967 void ResourceDispatcherHost::OnCertificateRequested( | 967 void ResourceDispatcherHost::OnCertificateRequested( |
| 968 URLRequest* request, | 968 URLRequest* request, |
| 969 net::SSLCertRequestInfo* cert_request_info) { | 969 net::SSLCertRequestInfo* cert_request_info) { |
| 970 DCHECK(request); | 970 DCHECK(request); |
| 971 | 971 |
| 972 #if defined(OS_LINUX) | |
| 973 bool select_first_cert = CommandLine::ForCurrentProcess()->HasSwitch( | |
| 974 switches::kAutoSSLClientAuth); | |
| 975 net::X509Certificate* cert = | |
| 976 select_first_cert && !cert_request_info->client_certs.empty() ? | |
| 977 cert_request_info->client_certs[0] : NULL; | |
| 978 request->ContinueWithCertificate(cert); | |
| 979 #else | |
| 980 if (cert_request_info->client_certs.empty()) { | 972 if (cert_request_info->client_certs.empty()) { |
| 981 // No need to query the user if there are no certs to choose from. | 973 // No need to query the user if there are no certs to choose from. |
| 982 request->ContinueWithCertificate(NULL); | 974 request->ContinueWithCertificate(NULL); |
| 983 return; | 975 return; |
| 984 } | 976 } |
| 985 | 977 |
| 986 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 978 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 987 DCHECK(!info->ssl_client_auth_handler()) << | 979 DCHECK(!info->ssl_client_auth_handler()) << |
| 988 "OnCertificateRequested called with ssl_client_auth_handler pending"; | 980 "OnCertificateRequested called with ssl_client_auth_handler pending"; |
| 989 info->set_ssl_client_auth_handler( | 981 info->set_ssl_client_auth_handler( |
| 990 new SSLClientAuthHandler(request, cert_request_info)); | 982 new SSLClientAuthHandler(request, cert_request_info)); |
| 991 info->ssl_client_auth_handler()->SelectCertificate(); | 983 info->ssl_client_auth_handler()->SelectCertificate(); |
| 992 #endif | |
| 993 } | 984 } |
| 994 | 985 |
| 995 void ResourceDispatcherHost::OnSSLCertificateError( | 986 void ResourceDispatcherHost::OnSSLCertificateError( |
| 996 URLRequest* request, | 987 URLRequest* request, |
| 997 int cert_error, | 988 int cert_error, |
| 998 net::X509Certificate* cert) { | 989 net::X509Certificate* cert) { |
| 999 DCHECK(request); | 990 DCHECK(request); |
| 1000 SSLManager::OnSSLCertificateError(this, request, cert_error, cert); | 991 SSLManager::OnSSLCertificateError(this, request, cert_error, cert); |
| 1001 } | 992 } |
| 1002 | 993 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 const ResourceType::Type& resource_type, | 1757 const ResourceType::Type& resource_type, |
| 1767 ResourceDispatcherHostRequestInfo* request_info) { | 1758 ResourceDispatcherHostRequestInfo* request_info) { |
| 1768 // Apply filter only to chrome extension css files that don't have | 1759 // Apply filter only to chrome extension css files that don't have |
| 1769 // security filter already set. | 1760 // security filter already set. |
| 1770 if (url.SchemeIs(chrome::kExtensionScheme) && | 1761 if (url.SchemeIs(chrome::kExtensionScheme) && |
| 1771 request_info->filter_policy() == FilterPolicy::DONT_FILTER && | 1762 request_info->filter_policy() == FilterPolicy::DONT_FILTER && |
| 1772 resource_type == ResourceType::STYLESHEET) { | 1763 resource_type == ResourceType::STYLESHEET) { |
| 1773 request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES); | 1764 request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES); |
| 1774 } | 1765 } |
| 1775 } | 1766 } |
| OLD | NEW |