OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 DCHECK(!info->login_handler()) << | 1045 DCHECK(!info->login_handler()) << |
1046 "OnAuthRequired called with login_handler pending"; | 1046 "OnAuthRequired called with login_handler pending"; |
1047 info->set_login_handler(CreateLoginPrompt(auth_info, request, ui_loop_)); | 1047 info->set_login_handler(CreateLoginPrompt(auth_info, request, ui_loop_)); |
1048 } | 1048 } |
1049 | 1049 |
1050 void ResourceDispatcherHost::OnCertificateRequested( | 1050 void ResourceDispatcherHost::OnCertificateRequested( |
1051 URLRequest* request, | 1051 URLRequest* request, |
1052 net::SSLCertRequestInfo* cert_request_info) { | 1052 net::SSLCertRequestInfo* cert_request_info) { |
1053 DCHECK(request); | 1053 DCHECK(request); |
1054 | 1054 |
| 1055 #if defined(OS_LINUX) |
| 1056 bool select_first_cert = CommandLine::ForCurrentProcess()->HasSwitch( |
| 1057 switches::kAutoSSLClientAuth); |
| 1058 net::X509Certificate* cert = |
| 1059 select_first_cert && !cert_request_info->client_certs.empty() ? |
| 1060 cert_request_info->client_certs[0] : NULL; |
| 1061 request->ContinueWithCertificate(cert); |
| 1062 #else |
1055 if (cert_request_info->client_certs.empty()) { | 1063 if (cert_request_info->client_certs.empty()) { |
1056 // No need to query the user if there are no certs to choose from. | 1064 // No need to query the user if there are no certs to choose from. |
1057 request->ContinueWithCertificate(NULL); | 1065 request->ContinueWithCertificate(NULL); |
1058 return; | 1066 return; |
1059 } | 1067 } |
1060 | 1068 |
1061 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1069 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1062 DCHECK(!info->ssl_client_auth_handler()) << | 1070 DCHECK(!info->ssl_client_auth_handler()) << |
1063 "OnCertificateRequested called with ssl_client_auth_handler pending"; | 1071 "OnCertificateRequested called with ssl_client_auth_handler pending"; |
1064 info->set_ssl_client_auth_handler( | 1072 info->set_ssl_client_auth_handler( |
1065 new SSLClientAuthHandler(request, cert_request_info, io_loop_, ui_loop_)); | 1073 new SSLClientAuthHandler(request, cert_request_info, io_loop_, ui_loop_)); |
1066 info->ssl_client_auth_handler()->SelectCertificate(); | 1074 info->ssl_client_auth_handler()->SelectCertificate(); |
| 1075 #endif |
1067 } | 1076 } |
1068 | 1077 |
1069 void ResourceDispatcherHost::OnSSLCertificateError( | 1078 void ResourceDispatcherHost::OnSSLCertificateError( |
1070 URLRequest* request, | 1079 URLRequest* request, |
1071 int cert_error, | 1080 int cert_error, |
1072 net::X509Certificate* cert) { | 1081 net::X509Certificate* cert) { |
1073 DCHECK(request); | 1082 DCHECK(request); |
1074 SSLManager::OnSSLCertificateError(this, request, cert_error, cert, ui_loop_); | 1083 SSLManager::OnSSLCertificateError(this, request, cert_error, cert, ui_loop_); |
1075 } | 1084 } |
1076 | 1085 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 case ViewHostMsg_UploadProgress_ACK::ID: | 1784 case ViewHostMsg_UploadProgress_ACK::ID: |
1776 case ViewHostMsg_SyncLoad::ID: | 1785 case ViewHostMsg_SyncLoad::ID: |
1777 return true; | 1786 return true; |
1778 | 1787 |
1779 default: | 1788 default: |
1780 break; | 1789 break; |
1781 } | 1790 } |
1782 | 1791 |
1783 return false; | 1792 return false; |
1784 } | 1793 } |
OLD | NEW |