OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> |
| 8 |
7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
9 #include "net/cert/cert_database.h" | 11 #include "net/cert/cert_database.h" |
10 #include "net/socket/client_socket_handle.h" | 12 #include "net/socket/client_socket_handle.h" |
11 #include "net/socket/tcp_client_socket.h" | 13 #include "net/socket/tcp_client_socket.h" |
12 #include "net/udp/udp_client_socket.h" | 14 #include "net/udp/udp_client_socket.h" |
13 | 15 |
14 #if defined(USE_OPENSSL) | 16 #if defined(USE_OPENSSL) |
15 #include "net/socket/ssl_client_socket_openssl.h" | 17 #include "net/socket/ssl_client_socket_openssl.h" |
16 #else | 18 #else |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return scoped_ptr<StreamSocket>( | 65 return scoped_ptr<StreamSocket>( |
64 new TCPClientSocket(addresses, net_log, source)); | 66 new TCPClientSocket(addresses, net_log, source)); |
65 } | 67 } |
66 | 68 |
67 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 69 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
68 scoped_ptr<ClientSocketHandle> transport_socket, | 70 scoped_ptr<ClientSocketHandle> transport_socket, |
69 const HostPortPair& host_and_port, | 71 const HostPortPair& host_and_port, |
70 const SSLConfig& ssl_config, | 72 const SSLConfig& ssl_config, |
71 const SSLClientSocketContext& context) override { | 73 const SSLClientSocketContext& context) override { |
72 #if defined(USE_OPENSSL) | 74 #if defined(USE_OPENSSL) |
73 return scoped_ptr<SSLClientSocket>( | 75 return scoped_ptr<SSLClientSocket>(new SSLClientSocketOpenSSL( |
74 new SSLClientSocketOpenSSL(transport_socket.Pass(), host_and_port, | 76 std::move(transport_socket), host_and_port, ssl_config, context)); |
75 ssl_config, context)); | |
76 #else | 77 #else |
77 return scoped_ptr<SSLClientSocket>(new SSLClientSocketNSS( | 78 return scoped_ptr<SSLClientSocket>(new SSLClientSocketNSS( |
78 transport_socket.Pass(), host_and_port, ssl_config, context)); | 79 transport_socket.Pass(), host_and_port, ssl_config, context)); |
79 #endif | 80 #endif |
80 } | 81 } |
81 | 82 |
82 void ClearSSLSessionCache() override { SSLClientSocket::ClearSessionCache(); } | 83 void ClearSSLSessionCache() override { SSLClientSocket::ClearSessionCache(); } |
83 }; | 84 }; |
84 | 85 |
85 static base::LazyInstance<DefaultClientSocketFactory>::Leaky | 86 static base::LazyInstance<DefaultClientSocketFactory>::Leaky |
86 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; | 87 g_default_client_socket_factory = LAZY_INSTANCE_INITIALIZER; |
87 | 88 |
88 } // namespace | 89 } // namespace |
89 | 90 |
90 // static | 91 // static |
91 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { | 92 ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() { |
92 return g_default_client_socket_factory.Pointer(); | 93 return g_default_client_socket_factory.Pointer(); |
93 } | 94 } |
94 | 95 |
95 } // namespace net | 96 } // namespace net |
OLD | NEW |