OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/socket/client_socket_factory.h" | 5 #include "net/socket/client_socket_factory.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "net/base/cert_database.h" | 9 #include "net/base/cert_database.h" |
10 #include "net/socket/client_socket_handle.h" | 10 #include "net/socket/client_socket_handle.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ClearSSLSessionCache(); | 45 ClearSSLSessionCache(); |
46 } | 46 } |
47 | 47 |
48 virtual void OnCertTrustChanged(const X509Certificate* cert) { | 48 virtual void OnCertTrustChanged(const X509Certificate* cert) { |
49 // Per wtc, we actually only need to flush when trust is reduced. | 49 // Per wtc, we actually only need to flush when trust is reduced. |
50 // Always flush now because OnCertTrustChanged does not tell us this. | 50 // Always flush now because OnCertTrustChanged does not tell us this. |
51 // See comments in ClientSocketPoolManager::OnCertTrustChanged. | 51 // See comments in ClientSocketPoolManager::OnCertTrustChanged. |
52 ClearSSLSessionCache(); | 52 ClearSSLSessionCache(); |
53 } | 53 } |
54 | 54 |
55 virtual ClientSocket* CreateTransportClientSocket( | 55 virtual StreamSocket* CreateTransportClientSocket( |
56 const AddressList& addresses, | 56 const AddressList& addresses, |
57 NetLog* net_log, | 57 NetLog* net_log, |
58 const NetLog::Source& source) { | 58 const NetLog::Source& source) { |
59 return new TCPClientSocket(addresses, net_log, source); | 59 return new TCPClientSocket(addresses, net_log, source); |
60 } | 60 } |
61 | 61 |
62 virtual SSLClientSocket* CreateSSLClientSocket( | 62 virtual SSLClientSocket* CreateSSLClientSocket( |
63 ClientSocketHandle* transport_socket, | 63 ClientSocketHandle* transport_socket, |
64 const HostPortPair& host_and_port, | 64 const HostPortPair& host_and_port, |
65 const SSLConfig& ssl_config, | 65 const SSLConfig& ssl_config, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 #endif | 114 #endif |
115 } | 115 } |
116 | 116 |
117 }; | 117 }; |
118 | 118 |
119 static base::LazyInstance<DefaultClientSocketFactory> | 119 static base::LazyInstance<DefaultClientSocketFactory> |
120 g_default_client_socket_factory(base::LINKER_INITIALIZED); | 120 g_default_client_socket_factory(base::LINKER_INITIALIZED); |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. | 124 // Deprecated function (http://crbug.com/37810) that takes a StreamSocket. |
125 SSLClientSocket* ClientSocketFactory::CreateSSLClientSocket( | 125 SSLClientSocket* ClientSocketFactory::CreateSSLClientSocket( |
126 ClientSocket* transport_socket, | 126 StreamSocket* transport_socket, |
127 const HostPortPair& host_and_port, | 127 const HostPortPair& host_and_port, |
128 const SSLConfig& ssl_config, | 128 const SSLConfig& ssl_config, |
129 SSLHostInfo* ssl_host_info, | 129 SSLHostInfo* ssl_host_info, |
130 CertVerifier* cert_verifier) { | 130 CertVerifier* cert_verifier) { |
131 ClientSocketHandle* socket_handle = new ClientSocketHandle(); | 131 ClientSocketHandle* socket_handle = new ClientSocketHandle(); |
132 socket_handle->set_socket(transport_socket); | 132 socket_handle->set_socket(transport_socket); |
133 return CreateSSLClientSocket(socket_handle, host_and_port, ssl_config, | 133 return CreateSSLClientSocket(socket_handle, host_and_port, ssl_config, |
134 ssl_host_info, cert_verifier, | 134 ssl_host_info, cert_verifier, |
135 NULL /* DnsCertProvenanceChecker */); | 135 NULL /* DnsCertProvenanceChecker */); |
136 } | 136 } |
137 | 137 |
138 // static | 138 // static |
139 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 139 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
140 return g_default_client_socket_factory.Pointer(); | 140 return g_default_client_socket_factory.Pointer(); |
141 } | 141 } |
142 | 142 |
143 // static | 143 // static |
144 void ClientSocketFactory::UseSystemSSL() { | 144 void ClientSocketFactory::UseSystemSSL() { |
145 g_use_system_ssl = true; | 145 g_use_system_ssl = true; |
146 } | 146 } |
147 | 147 |
148 } // namespace net | 148 } // namespace net |
OLD | NEW |