1 // Copyright 2015 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 
5 #ifndef SERVICES_NETWORK_PROXY_SERVICE_MOJO_H_
6 #define SERVICES_NETWORK_PROXY_SERVICE_MOJO_H_
7 
8 #include <memory>
9 
10 #include "base/component_export.h"
11 #include "mojo/public/cpp/bindings/pending_remote.h"
12 #include "net/proxy_resolution/dhcp_pac_file_fetcher.h"
13 #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
14 
15 namespace net {
16 class ConfiguredProxyResolutionService;
17 class HostResolver;
18 class NetLog;
19 class NetworkDelegate;
20 class ProxyConfigService;
21 class PacFileFetcher;
22 }  // namespace net
23 
24 namespace network {
25 
26 // Creates a proxy resolution service that uses |mojo_proxy_factory| to create
27 // and connect to a Mojo service for evaluating PAC files
28 // (ProxyResolverFactory). The proxy service observes |proxy_config_service| to
29 // notice when the proxy settings change.
30 //
31 // |pac_file_fetcher| specifies the dependency to use for downloading
32 // any PAC scripts.
33 //
34 // |dhcp_pac_file_fetcher| specifies the dependency to use for attempting
35 // to retrieve the most appropriate PAC script configured in DHCP.
36 //
37 // |host_resolver| points to the host resolving dependency the PAC script
38 // should use for any DNS queries. It must remain valid throughout the
39 // lifetime of the ConfiguredProxyResolutionService.
40 COMPONENT_EXPORT(NETWORK_SERVICE)
41 std::unique_ptr<net::ConfiguredProxyResolutionService>
42 CreateConfiguredProxyResolutionServiceUsingMojoFactory(
43     mojo::PendingRemote<proxy_resolver::mojom::ProxyResolverFactory>
44         mojo_proxy_factory,
45     std::unique_ptr<net::ProxyConfigService> proxy_config_service,
46     std::unique_ptr<net::PacFileFetcher> pac_file_fetcher,
47     std::unique_ptr<net::DhcpPacFileFetcher> dhcp_pac_file_fetcher,
48     net::HostResolver* host_resolver,
49     net::NetLog* net_log,
50     bool pac_quick_check_enabled,
51     net::NetworkDelegate* network_delegate);
52 
53 }  // namespace network
54 
55 #endif  // SERVICES_NETWORK_PROXY_SERVICE_MOJO_H_
56