1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/socket/network_binding_client_socket_factory.h"
6
7 #include "net/socket/tcp_client_socket.h"
8 #include "net/socket/udp_client_socket.h"
9
10 namespace net {
11
NetworkBindingClientSocketFactory(handles::NetworkHandle network)12 NetworkBindingClientSocketFactory::NetworkBindingClientSocketFactory(
13 handles::NetworkHandle network)
14 : network_(network) {}
15
16 std::unique_ptr<DatagramClientSocket>
CreateDatagramClientSocket(DatagramSocket::BindType bind_type,NetLog * net_log,const NetLogSource & source)17 NetworkBindingClientSocketFactory::CreateDatagramClientSocket(
18 DatagramSocket::BindType bind_type,
19 NetLog* net_log,
20 const NetLogSource& source) {
21 return std::make_unique<UDPClientSocket>(bind_type, net_log, source,
22 network_);
23 }
24
25 std::unique_ptr<TransportClientSocket>
CreateTransportClientSocket(const AddressList & addresses,std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,NetworkQualityEstimator * network_quality_estimator,NetLog * net_log,const NetLogSource & source)26 NetworkBindingClientSocketFactory::CreateTransportClientSocket(
27 const AddressList& addresses,
28 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
29 NetworkQualityEstimator* network_quality_estimator,
30 NetLog* net_log,
31 const NetLogSource& source) {
32 return std::make_unique<TCPClientSocket>(
33 addresses, std::move(socket_performance_watcher),
34 network_quality_estimator, net_log, source, network_);
35 }
36
37 std::unique_ptr<SSLClientSocket>
CreateSSLClientSocket(SSLClientContext * context,std::unique_ptr<StreamSocket> stream_socket,const HostPortPair & host_and_port,const SSLConfig & ssl_config)38 NetworkBindingClientSocketFactory::CreateSSLClientSocket(
39 SSLClientContext* context,
40 std::unique_ptr<StreamSocket> stream_socket,
41 const HostPortPair& host_and_port,
42 const SSLConfig& ssl_config) {
43 return ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket(
44 context, std::move(stream_socket), host_and_port, ssl_config);
45 }
46
47 } // namespace net
48