windows_system_proxy_resolver_mojo.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2021 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_WINDOWS_SYSTEM_PROXY_RESOLVER_MOJO_H_
  5. #define SERVICES_NETWORK_WINDOWS_SYSTEM_PROXY_RESOLVER_MOJO_H_
  6. #include <string>
  7. #include "base/component_export.h"
  8. #include "mojo/public/cpp/bindings/pending_remote.h"
  9. #include "mojo/public/cpp/bindings/remote.h"
  10. #include "net/proxy_resolution/win/windows_system_proxy_resolver.h"
  11. #include "services/proxy_resolver_win/public/mojom/proxy_resolver_win.mojom.h"
  12. #include "url/gurl.h"
  13. namespace net {
  14. class WindowsSystemProxyResolutionRequest;
  15. } // namespace net
  16. namespace network {
  17. // This is the concrete implementation of net::WindowsSystemProxyResolver that
  18. // connects to a Mojo service to actually do proxy resolution. It contains no
  19. // business logic, only passing the request along to the service.
  20. class COMPONENT_EXPORT(NETWORK_SERVICE) WindowsSystemProxyResolverMojo final
  21. : public net::WindowsSystemProxyResolver {
  22. public:
  23. explicit WindowsSystemProxyResolverMojo(
  24. mojo::PendingRemote<proxy_resolver_win::mojom::WindowsSystemProxyResolver>
  25. mojo_windows_system_proxy_resolver);
  26. WindowsSystemProxyResolverMojo(const WindowsSystemProxyResolverMojo&) =
  27. delete;
  28. WindowsSystemProxyResolverMojo& operator=(
  29. const WindowsSystemProxyResolverMojo&) = delete;
  30. ~WindowsSystemProxyResolverMojo() override;
  31. // net::WindowsSystemProxyResolver implementation
  32. std::unique_ptr<net::WindowsSystemProxyResolver::Request> GetProxyForUrl(
  33. const GURL& url,
  34. net::WindowsSystemProxyResolutionRequest* callback_target) override;
  35. private:
  36. class RequestImpl;
  37. mojo::Remote<proxy_resolver_win::mojom::WindowsSystemProxyResolver>
  38. mojo_windows_system_proxy_resolver_;
  39. };
  40. } // namespace network
  41. #endif // SERVICES_NETWORK_WINDOWS_SYSTEM_PROXY_RESOLVER_MOJO_H_