proxy_resolving_socket_factory_mojo.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2018 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. #ifndef SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_H_
  5. #define SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_H_
  6. #include "base/component_export.h"
  7. #include "base/memory/ref_counted.h"
  8. #include "mojo/public/cpp/bindings/pending_receiver.h"
  9. #include "mojo/public/cpp/bindings/pending_remote.h"
  10. #include "mojo/public/cpp/bindings/unique_receiver_set.h"
  11. #include "net/traffic_annotation/network_traffic_annotation.h"
  12. #include "services/network/proxy_resolving_client_socket_factory.h"
  13. #include "services/network/public/mojom/proxy_resolving_socket.mojom.h"
  14. #include "services/network/tls_socket_factory.h"
  15. namespace net {
  16. class NetworkIsolationKey;
  17. class URLRequestContext;
  18. } // namespace net
  19. namespace network {
  20. class COMPONENT_EXPORT(NETWORK_SERVICE) ProxyResolvingSocketFactoryMojo
  21. : public mojom::ProxyResolvingSocketFactory {
  22. public:
  23. ProxyResolvingSocketFactoryMojo(net::URLRequestContext* request_context);
  24. ProxyResolvingSocketFactoryMojo(const ProxyResolvingSocketFactoryMojo&) =
  25. delete;
  26. ProxyResolvingSocketFactoryMojo& operator=(
  27. const ProxyResolvingSocketFactoryMojo&) = delete;
  28. ~ProxyResolvingSocketFactoryMojo() override;
  29. // mojom::ProxyResolvingSocketFactory implementation.
  30. void CreateProxyResolvingSocket(
  31. const GURL& url,
  32. const net::NetworkIsolationKey& network_isolation_key,
  33. mojom::ProxyResolvingSocketOptionsPtr options,
  34. const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
  35. mojo::PendingReceiver<mojom::ProxyResolvingSocket> receiver,
  36. mojo::PendingRemote<mojom::SocketObserver> observer,
  37. CreateProxyResolvingSocketCallback callback) override;
  38. private:
  39. ProxyResolvingClientSocketFactory factory_impl_;
  40. TLSSocketFactory tls_socket_factory_;
  41. mojo::UniqueReceiverSet<mojom::ProxyResolvingSocket>
  42. proxy_resolving_socket_receivers_;
  43. };
  44. } // namespace network
  45. #endif // SERVICES_NETWORK_PROXY_RESOLVING_SOCKET_FACTORY_MOJO_H_