brokered_client_socket_factory.cc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "services/network/brokered_client_socket_factory.h"
  5. #include "build/build_config.h"
  6. #include "net/socket/datagram_client_socket.h"
  7. #include "net/socket/tcp_client_socket.h"
  8. #include "services/network/tcp_client_socket_brokered.h"
  9. namespace net {
  10. class AddressList;
  11. class HostPortPair;
  12. class NetLog;
  13. struct NetLogSource;
  14. class SSLClientContext;
  15. class SSLClientSocket;
  16. struct SSLConfig;
  17. class NetworkQualityEstimator;
  18. } // namespace net
  19. namespace network {
  20. BrokeredClientSocketFactory::BrokeredClientSocketFactory(
  21. mojo::PendingRemote<mojom::SocketBroker> pending_remote)
  22. : socket_broker_(std::move(pending_remote)) {}
  23. BrokeredClientSocketFactory::~BrokeredClientSocketFactory() = default;
  24. std::unique_ptr<net::DatagramClientSocket>
  25. BrokeredClientSocketFactory::CreateDatagramClientSocket(
  26. net::DatagramSocket::BindType bind_type,
  27. net::NetLog* net_log,
  28. const net::NetLogSource& source) {
  29. NOTIMPLEMENTED();
  30. return nullptr;
  31. }
  32. std::unique_ptr<net::TransportClientSocket>
  33. BrokeredClientSocketFactory::CreateTransportClientSocket(
  34. const net::AddressList& addresses,
  35. std::unique_ptr<net::SocketPerformanceWatcher> socket_performance_watcher,
  36. net::NetworkQualityEstimator* network_quality_estimator,
  37. net::NetLog* net_log,
  38. const net::NetLogSource& source) {
  39. return std::make_unique<TCPClientSocketBrokered>(
  40. addresses, std::move(socket_performance_watcher),
  41. network_quality_estimator, net_log, source, this);
  42. }
  43. std::unique_ptr<net::SSLClientSocket>
  44. BrokeredClientSocketFactory::CreateSSLClientSocket(
  45. net::SSLClientContext* context,
  46. std::unique_ptr<net::StreamSocket> stream_socket,
  47. const net::HostPortPair& host_and_port,
  48. const net::SSLConfig& ssl_config) {
  49. NOTIMPLEMENTED();
  50. return nullptr;
  51. }
  52. void BrokeredClientSocketFactory::BrokerCreateTcpSocket(
  53. net::AddressFamily address_family,
  54. mojom::SocketBroker::CreateTcpSocketCallback callback) {
  55. socket_broker_->CreateTcpSocket(address_family, std::move(callback));
  56. }
  57. } // namespace network