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 ClientSocket; | 18 class ClientSocket; |
18 class ClientSocketHandle; | 19 class ClientSocketHandle; |
19 class DnsCertProvenanceChecker; | 20 class DnsCertProvenanceChecker; |
20 class HostPortPair; | 21 class HostPortPair; |
21 class SSLClientSocket; | 22 class SSLClientSocket; |
22 struct SSLConfig; | 23 struct SSLConfig; |
23 class SSLHostInfo; | 24 class SSLHostInfo; |
24 | 25 |
25 // Callback function to create new SSLClientSocket objects. | 26 // Callback function to create new SSLClientSocket objects. |
26 typedef SSLClientSocket* (*SSLClientSocketFactory)( | 27 typedef SSLClientSocket* (*SSLClientSocketFactory)( |
27 ClientSocketHandle* transport_socket, | 28 ClientSocketHandle* transport_socket, |
28 const HostPortPair& host_and_port, | 29 const HostPortPair& host_and_port, |
29 const SSLConfig& ssl_config, | 30 const SSLConfig& ssl_config, |
30 SSLHostInfo* ssl_host_info, | 31 SSLHostInfo* ssl_host_info, |
| 32 CertVerifier* cert_verifier, |
31 DnsCertProvenanceChecker* dns_cert_checker); | 33 DnsCertProvenanceChecker* dns_cert_checker); |
32 | 34 |
33 // An interface used to instantiate ClientSocket objects. Used to facilitate | 35 // An interface used to instantiate ClientSocket objects. Used to facilitate |
34 // testing code with mock socket implementations. | 36 // testing code with mock socket implementations. |
35 class ClientSocketFactory { | 37 class ClientSocketFactory { |
36 public: | 38 public: |
37 virtual ~ClientSocketFactory() {} | 39 virtual ~ClientSocketFactory() {} |
38 | 40 |
39 // |source| is the NetLog::Source for the entity trying to create the socket, | 41 // |source| is the NetLog::Source for the entity trying to create the socket, |
40 // if it has one. | 42 // if it has one. |
41 virtual ClientSocket* CreateTCPClientSocket( | 43 virtual ClientSocket* CreateTCPClientSocket( |
42 const AddressList& addresses, | 44 const AddressList& addresses, |
43 NetLog* net_log, | 45 NetLog* net_log, |
44 const NetLog::Source& source) = 0; | 46 const NetLog::Source& source) = 0; |
45 | 47 |
46 virtual SSLClientSocket* CreateSSLClientSocket( | 48 virtual SSLClientSocket* CreateSSLClientSocket( |
47 ClientSocketHandle* transport_socket, | 49 ClientSocketHandle* transport_socket, |
48 const HostPortPair& host_and_port, | 50 const HostPortPair& host_and_port, |
49 const SSLConfig& ssl_config, | 51 const SSLConfig& ssl_config, |
50 SSLHostInfo* ssl_host_info, | 52 SSLHostInfo* ssl_host_info, |
| 53 CertVerifier* cert_verifier, |
51 DnsCertProvenanceChecker* dns_cert_checker) = 0; | 54 DnsCertProvenanceChecker* dns_cert_checker) = 0; |
52 | 55 |
53 // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. | 56 // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. |
54 virtual SSLClientSocket* CreateSSLClientSocket( | 57 virtual SSLClientSocket* CreateSSLClientSocket( |
55 ClientSocket* transport_socket, | 58 ClientSocket* transport_socket, |
56 const HostPortPair& host_and_port, | 59 const HostPortPair& host_and_port, |
57 const SSLConfig& ssl_config, | 60 const SSLConfig& ssl_config, |
58 SSLHostInfo* ssl_host_info); | 61 SSLHostInfo* ssl_host_info, |
| 62 CertVerifier* cert_verifier); |
59 | 63 |
60 // Returns the default ClientSocketFactory. | 64 // Returns the default ClientSocketFactory. |
61 static ClientSocketFactory* GetDefaultFactory(); | 65 static ClientSocketFactory* GetDefaultFactory(); |
62 | 66 |
63 // Instructs the default ClientSocketFactory to use |factory| to create | 67 // Instructs the default ClientSocketFactory to use |factory| to create |
64 // SSLClientSocket objects. | 68 // SSLClientSocket objects. |
65 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); | 69 static void SetSSLClientSocketFactory(SSLClientSocketFactory factory); |
66 }; | 70 }; |
67 | 71 |
68 } // namespace net | 72 } // namespace net |
69 | 73 |
70 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ | 74 #endif // NET_SOCKET_CLIENT_SOCKET_FACTORY_H_ |
OLD | NEW |