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