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