OLD | NEW |
1 // Copyright (c) 2010 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 #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 ClientSocketHandle; |
14 class NetLog; | 15 class NetLog; |
15 class SSLClientSocket; | 16 class SSLClientSocket; |
16 struct SSLConfig; | 17 struct SSLConfig; |
17 | 18 |
18 // Callback function to create new SSLClientSocket objects. | 19 // Callback function to create new SSLClientSocket objects. |
19 typedef SSLClientSocket* (*SSLClientSocketFactory)( | 20 typedef SSLClientSocket* (*SSLClientSocketFactory)( |
20 ClientSocket* transport_socket, | 21 ClientSocketHandle* transport_socket, |
21 const std::string& hostname, | 22 const std::string& hostname, |
22 const SSLConfig& ssl_config); | 23 const SSLConfig& ssl_config); |
23 | 24 |
24 // An interface used to instantiate ClientSocket objects. Used to facilitate | 25 // An interface used to instantiate ClientSocket objects. Used to facilitate |
25 // testing code with mock socket implementations. | 26 // testing code with mock socket implementations. |
26 class ClientSocketFactory { | 27 class ClientSocketFactory { |
27 public: | 28 public: |
28 virtual ~ClientSocketFactory() {} | 29 virtual ~ClientSocketFactory() {} |
29 | 30 |
30 virtual ClientSocket* CreateTCPClientSocket( | 31 virtual ClientSocket* CreateTCPClientSocket( |
31 const AddressList& addresses, NetLog* net_log) = 0; | 32 const AddressList& addresses, NetLog* net_log) = 0; |
32 | 33 |
33 virtual SSLClientSocket* CreateSSLClientSocket( | 34 virtual SSLClientSocket* CreateSSLClientSocket( |
34 ClientSocket* transport_socket, | 35 ClientSocketHandle* transport_socket, |
35 const std::string& hostname, | 36 const std::string& hostname, |
36 const SSLConfig& ssl_config) = 0; | 37 const SSLConfig& ssl_config) = 0; |
37 | 38 |
| 39 |
| 40 // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. |
| 41 virtual SSLClientSocket* CreateSSLClientSocket(ClientSocket* transport_socket, |
| 42 const std::string& hostname, |
| 43 const SSLConfig& ssl_config); |
| 44 |
38 // Returns the default ClientSocketFactory. | 45 // Returns the default ClientSocketFactory. |
39 static ClientSocketFactory* GetDefaultFactory(); | 46 static ClientSocketFactory* GetDefaultFactory(); |
40 | 47 |
41 // Instructs the default ClientSocketFactory to use |factory| to create | 48 // Instructs the default ClientSocketFactory to use |factory| to create |
42 // SSLClientSocket objects. | 49 // SSLClientSocket objects. |
43 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | 50 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); |
44 }; | 51 }; |
45 | 52 |
46 } // namespace net | 53 } // namespace net |
47 | 54 |
48 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 55 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
OLD | NEW |