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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class AddressList; | 16 class AddressList; |
17 class CertVerifier; | 17 class CertVerifier; |
18 class ClientSocket; | 18 class ClientSocket; |
19 class ClientSocketHandle; | 19 class ClientSocketHandle; |
20 class DnsCertProvenanceChecker; | 20 class DnsCertProvenanceChecker; |
21 class HostPortPair; | 21 class HostPortPair; |
22 class SSLClientSocket; | 22 class SSLClientSocket; |
23 struct SSLConfig; | 23 struct SSLConfig; |
24 class SSLHostInfo; | 24 class SSLHostInfo; |
25 | 25 |
26 // Callback function to create new SSLClientSocket objects. | |
27 typedef SSLClientSocket* (*SSLClientSocketFactory)( | |
28 ClientSocketHandle* transport_socket, | |
29 const HostPortPair& host_and_port, | |
30 const SSLConfig& ssl_config, | |
31 SSLHostInfo* ssl_host_info, | |
32 CertVerifier* cert_verifier, | |
33 DnsCertProvenanceChecker* dns_cert_checker); | |
34 | |
35 // An interface used to instantiate ClientSocket objects. Used to facilitate | 26 // An interface used to instantiate ClientSocket objects. Used to facilitate |
36 // testing code with mock socket implementations. | 27 // testing code with mock socket implementations. |
37 class ClientSocketFactory { | 28 class ClientSocketFactory { |
38 public: | 29 public: |
39 virtual ~ClientSocketFactory() {} | 30 virtual ~ClientSocketFactory() {} |
40 | 31 |
41 // |source| is the NetLog::Source for the entity trying to create the socket, | 32 // |source| is the NetLog::Source for the entity trying to create the socket, |
42 // if it has one. | 33 // if it has one. |
43 virtual ClientSocket* CreateTCPClientSocket( | 34 virtual ClientSocket* CreateTCPClientSocket( |
44 const AddressList& addresses, | 35 const AddressList& addresses, |
(...skipping 12 matching lines...) Expand all Loading... |
57 virtual SSLClientSocket* CreateSSLClientSocket( | 48 virtual SSLClientSocket* CreateSSLClientSocket( |
58 ClientSocket* transport_socket, | 49 ClientSocket* transport_socket, |
59 const HostPortPair& host_and_port, | 50 const HostPortPair& host_and_port, |
60 const SSLConfig& ssl_config, | 51 const SSLConfig& ssl_config, |
61 SSLHostInfo* ssl_host_info, | 52 SSLHostInfo* ssl_host_info, |
62 CertVerifier* cert_verifier); | 53 CertVerifier* cert_verifier); |
63 | 54 |
64 // Returns the default ClientSocketFactory. | 55 // Returns the default ClientSocketFactory. |
65 static ClientSocketFactory* GetDefaultFactory(); | 56 static ClientSocketFactory* GetDefaultFactory(); |
66 | 57 |
67 // Instructs the default ClientSocketFactory to use |factory| to create | 58 // Instructs the default ClientSocketFactory to use the system SSL library. |
68 // SSLClientSocket objects. | 59 static void UseSystemSSL(); |
69 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | |
70 }; | 60 }; |
71 | 61 |
72 } // namespace net | 62 } // namespace net |
73 | 63 |
74 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 64 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
OLD | NEW |