| 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 #include "net/socket/client_socket_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "net/socket/client_socket_handle.h" | 9 #include "net/socket/client_socket_handle.h" |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| 11 #include "net/socket/ssl_client_socket_win.h" | 11 #include "net/socket/ssl_client_socket_win.h" |
| 12 #elif defined(USE_OPENSSL) |
| 13 #include "net/socket/ssl_client_socket_openssl.h" |
| 12 #elif defined(USE_NSS) | 14 #elif defined(USE_NSS) |
| 13 #include "net/socket/ssl_client_socket_nss.h" | 15 #include "net/socket/ssl_client_socket_nss.h" |
| 14 #elif defined(OS_MACOSX) | 16 #elif defined(OS_MACOSX) |
| 15 #include "net/socket/ssl_client_socket_mac.h" | 17 #include "net/socket/ssl_client_socket_mac.h" |
| 16 #include "net/socket/ssl_client_socket_nss.h" | 18 #include "net/socket/ssl_client_socket_nss.h" |
| 17 #endif | 19 #endif |
| 18 #include "net/socket/tcp_client_socket.h" | 20 #include "net/socket/tcp_client_socket.h" |
| 19 | 21 |
| 20 namespace net { | 22 namespace net { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 SSLClientSocket* DefaultSSLClientSocketFactory( | 26 SSLClientSocket* DefaultSSLClientSocketFactory( |
| 25 ClientSocketHandle* transport_socket, | 27 ClientSocketHandle* transport_socket, |
| 26 const std::string& hostname, | 28 const std::string& hostname, |
| 27 const SSLConfig& ssl_config) { | 29 const SSLConfig& ssl_config) { |
| 28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 29 return new SSLClientSocketWin(transport_socket, hostname, ssl_config); | 31 return new SSLClientSocketWin(transport_socket, hostname, ssl_config); |
| 32 #elif defined(USE_OPENSSL) |
| 33 return new SSLClientSocketOpenSSL(transport_socket, hostname, ssl_config); |
| 30 #elif defined(USE_NSS) | 34 #elif defined(USE_NSS) |
| 31 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); | 35 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); |
| 32 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
| 33 // TODO(wtc): SSLClientSocketNSS can't do SSL client authentication using | 37 // TODO(wtc): SSLClientSocketNSS can't do SSL client authentication using |
| 34 // Mac OS X CDSA/CSSM yet (http://crbug.com/45369), so fall back on | 38 // Mac OS X CDSA/CSSM yet (http://crbug.com/45369), so fall back on |
| 35 // SSLClientSocketMac. | 39 // SSLClientSocketMac. |
| 36 if (ssl_config.send_client_cert) | 40 if (ssl_config.send_client_cert) |
| 37 return new SSLClientSocketMac(transport_socket, hostname, ssl_config); | 41 return new SSLClientSocketMac(transport_socket, hostname, ssl_config); |
| 38 | 42 |
| 39 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); | 43 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 SSLClientSocket* ClientSocketFactory::CreateSSLClientSocket( | 83 SSLClientSocket* ClientSocketFactory::CreateSSLClientSocket( |
| 80 ClientSocket* transport_socket, | 84 ClientSocket* transport_socket, |
| 81 const std::string& hostname, | 85 const std::string& hostname, |
| 82 const SSLConfig& ssl_config) { | 86 const SSLConfig& ssl_config) { |
| 83 ClientSocketHandle* socket_handle = new ClientSocketHandle(); | 87 ClientSocketHandle* socket_handle = new ClientSocketHandle(); |
| 84 socket_handle->set_socket(transport_socket); | 88 socket_handle->set_socket(transport_socket); |
| 85 return CreateSSLClientSocket(socket_handle, hostname, ssl_config); | 89 return CreateSSLClientSocket(socket_handle, hostname, ssl_config); |
| 86 } | 90 } |
| 87 | 91 |
| 88 } // namespace net | 92 } // namespace net |
| OLD | NEW |