| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 #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" |
| 11 #elif defined(USE_NSS) | 11 #elif defined(USE_NSS) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 33 NOTIMPLEMENTED(); | 33 NOTIMPLEMENTED(); |
| 34 return NULL; | 34 return NULL; |
| 35 #endif | 35 #endif |
| 36 } | 36 } |
| 37 | 37 |
| 38 SSLClientSocketFactory g_ssl_factory = DefaultSSLClientSocketFactory; | 38 SSLClientSocketFactory g_ssl_factory = DefaultSSLClientSocketFactory; |
| 39 | 39 |
| 40 class DefaultClientSocketFactory : public ClientSocketFactory { | 40 class DefaultClientSocketFactory : public ClientSocketFactory { |
| 41 public: | 41 public: |
| 42 virtual ClientSocket* CreateTCPClientSocket( | 42 virtual ClientSocket* CreateTCPClientSocket( |
| 43 const AddressList& addresses) { | 43 const AddressList& addresses, NetLog* net_log) { |
| 44 return new TCPClientSocket(addresses); | 44 return new TCPClientSocket(addresses, net_log); |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual SSLClientSocket* CreateSSLClientSocket( | 47 virtual SSLClientSocket* CreateSSLClientSocket( |
| 48 ClientSocket* transport_socket, | 48 ClientSocket* transport_socket, |
| 49 const std::string& hostname, | 49 const std::string& hostname, |
| 50 const SSLConfig& ssl_config) { | 50 const SSLConfig& ssl_config) { |
| 51 return g_ssl_factory(transport_socket, hostname, ssl_config); | 51 return g_ssl_factory(transport_socket, hostname, ssl_config); |
| 52 } | 52 } |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 58 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
| 59 return Singleton<DefaultClientSocketFactory>::get(); | 59 return Singleton<DefaultClientSocketFactory>::get(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // static | 62 // static |
| 63 void ClientSocketFactory::SetSSLClientSocketFactory( | 63 void ClientSocketFactory::SetSSLClientSocketFactory( |
| 64 SSLClientSocketFactory factory) { | 64 SSLClientSocketFactory factory) { |
| 65 g_ssl_factory = factory; | 65 g_ssl_factory = factory; |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace net | 68 } // namespace net |
| OLD | NEW |