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