| 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 #ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 class AddressList; | 12 class AddressList; |
| 13 class ClientSocket; | 13 class ClientSocket; |
| 14 class SSLClientSocket; | 14 class SSLClientSocket; |
| 15 struct SSLConfig; | 15 struct SSLConfig; |
| 16 | 16 |
| 17 // Callback function to create new SSLClientSocket objects. | 17 // Callback function to create new SSLClientSocket objects. |
| 18 typedef SSLClientSocket* (*SSLClientSocketFactory)( | 18 typedef SSLClientSocket* (*SSLClientSocketFactory)( |
| 19 ClientSocket* transport_socket, | 19 ClientSocket* transport_socket, |
| 20 const std::string& hostname, | 20 const std::string& hostname, |
| 21 const SSLConfig& ssl_config); | 21 const SSLConfig& ssl_config); |
| 22 | 22 |
| 23 // Creates SSLClientSocketNSS objects. | |
| 24 SSLClientSocket* SSLClientSocketNSSFactory( | |
| 25 ClientSocket* transport_socket, | |
| 26 const std::string& hostname, | |
| 27 const SSLConfig& ssl_config); | |
| 28 | |
| 29 // An interface used to instantiate ClientSocket objects. Used to facilitate | 23 // An interface used to instantiate ClientSocket objects. Used to facilitate |
| 30 // testing code with mock socket implementations. | 24 // testing code with mock socket implementations. |
| 31 class ClientSocketFactory { | 25 class ClientSocketFactory { |
| 32 public: | 26 public: |
| 33 virtual ~ClientSocketFactory() {} | 27 virtual ~ClientSocketFactory() {} |
| 34 | 28 |
| 35 virtual ClientSocket* CreateTCPClientSocket( | 29 virtual ClientSocket* CreateTCPClientSocket( |
| 36 const AddressList& addresses) = 0; | 30 const AddressList& addresses) = 0; |
| 37 | 31 |
| 38 virtual SSLClientSocket* CreateSSLClientSocket( | 32 virtual SSLClientSocket* CreateSSLClientSocket( |
| 39 ClientSocket* transport_socket, | 33 ClientSocket* transport_socket, |
| 40 const std::string& hostname, | 34 const std::string& hostname, |
| 41 const SSLConfig& ssl_config) = 0; | 35 const SSLConfig& ssl_config) = 0; |
| 42 | 36 |
| 43 // Returns the default ClientSocketFactory. | 37 // Returns the default ClientSocketFactory. |
| 44 static ClientSocketFactory* GetDefaultFactory(); | 38 static ClientSocketFactory* GetDefaultFactory(); |
| 45 | 39 |
| 46 // Instructs the default ClientSocketFactory to use |factory| to create | 40 // Instructs the default ClientSocketFactory to use |factory| to create |
| 47 // SSLClientSocket objects. | 41 // SSLClientSocket objects. |
| 48 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | 42 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); |
| 49 }; | 43 }; |
| 50 | 44 |
| 51 } // namespace net | 45 } // namespace net |
| 52 | 46 |
| 53 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 47 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
| OLD | NEW |