| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include "net/socket/ssl_client_socket_win.h" | 10 #include "net/socket/ssl_client_socket_win.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #elif defined(USE_NSS) | 28 #elif defined(USE_NSS) |
| 29 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); | 29 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); |
| 30 #elif defined(OS_MACOSX) | 30 #elif defined(OS_MACOSX) |
| 31 return new SSLClientSocketMac(transport_socket, hostname, ssl_config); | 31 return new SSLClientSocketMac(transport_socket, hostname, ssl_config); |
| 32 #else | 32 #else |
| 33 NOTIMPLEMENTED(); | 33 NOTIMPLEMENTED(); |
| 34 return NULL; | 34 return NULL; |
| 35 #endif | 35 #endif |
| 36 } | 36 } |
| 37 | 37 |
| 38 // True if we should use NSS instead of the system SSL library for SSL. | |
| 39 SSLClientSocketFactory g_ssl_factory = DefaultSSLClientSocketFactory; | 38 SSLClientSocketFactory g_ssl_factory = DefaultSSLClientSocketFactory; |
| 40 | 39 |
| 41 class DefaultClientSocketFactory : public ClientSocketFactory { | 40 class DefaultClientSocketFactory : public ClientSocketFactory { |
| 42 public: | 41 public: |
| 43 virtual ClientSocket* CreateTCPClientSocket( | 42 virtual ClientSocket* CreateTCPClientSocket( |
| 44 const AddressList& addresses) { | 43 const AddressList& addresses) { |
| 45 return new TCPClientSocket(addresses); | 44 return new TCPClientSocket(addresses); |
| 46 } | 45 } |
| 47 | 46 |
| 48 virtual SSLClientSocket* CreateSSLClientSocket( | 47 virtual SSLClientSocket* CreateSSLClientSocket( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 return Singleton<DefaultClientSocketFactory>::get(); | 59 return Singleton<DefaultClientSocketFactory>::get(); |
| 61 } | 60 } |
| 62 | 61 |
| 63 // static | 62 // static |
| 64 void ClientSocketFactory::SetSSLClientSocketFactory( | 63 void ClientSocketFactory::SetSSLClientSocketFactory( |
| 65 SSLClientSocketFactory factory) { | 64 SSLClientSocketFactory factory) { |
| 66 g_ssl_factory = factory; | 65 g_ssl_factory = factory; |
| 67 } | 66 } |
| 68 | 67 |
| 69 } // namespace net | 68 } // namespace net |
| OLD | NEW |