| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/base/client_socket_factory.h" | |
| 6 | |
| 7 #include "base/singleton.h" | |
| 8 #include "build/build_config.h" | |
| 9 #if defined(OS_WIN) | |
| 10 #include "net/base/ssl_client_socket_win.h" | |
| 11 #elif defined(OS_LINUX) | |
| 12 #include "net/base/ssl_client_socket_nss.h" | |
| 13 #elif defined(OS_MACOSX) | |
| 14 #include "net/base/ssl_client_socket_mac.h" | |
| 15 #endif | |
| 16 #include "net/base/tcp_client_socket.h" | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 class DefaultClientSocketFactory : public ClientSocketFactory { | |
| 21 public: | |
| 22 virtual ClientSocket* CreateTCPClientSocket( | |
| 23 const AddressList& addresses) { | |
| 24 return new TCPClientSocket(addresses); | |
| 25 } | |
| 26 | |
| 27 virtual SSLClientSocket* CreateSSLClientSocket( | |
| 28 ClientSocket* transport_socket, | |
| 29 const std::string& hostname, | |
| 30 const SSLConfig& ssl_config) { | |
| 31 #if defined(OS_WIN) | |
| 32 return new SSLClientSocketWin(transport_socket, hostname, ssl_config); | |
| 33 #elif defined(OS_LINUX) | |
| 34 return new SSLClientSocketNSS(transport_socket, hostname, ssl_config); | |
| 35 #elif defined(OS_MACOSX) | |
| 36 return new SSLClientSocketMac(transport_socket, hostname, ssl_config); | |
| 37 #else | |
| 38 NOTIMPLEMENTED(); | |
| 39 return NULL; | |
| 40 #endif | |
| 41 } | |
| 42 }; | |
| 43 | |
| 44 // static | |
| 45 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | |
| 46 return Singleton<DefaultClientSocketFactory>::get(); | |
| 47 } | |
| 48 | |
| 49 } // namespace net | |
| OLD | NEW |