Rename InputLatency::ScrollUpdate to Latency::ScrollUpdate
[chromium-blink-merge.git] / net / proxy / proxy_service_mojo.cc
blobea9f2e608825f0bf2929b2bb36ec1fa0683d9827
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.
5 #include "net/proxy/proxy_service_mojo.h"
7 #include "base/logging.h"
8 #include "net/dns/host_resolver_mojo.h"
9 #include "net/interfaces/proxy_resolver_service.mojom.h"
10 #include "net/proxy/in_process_mojo_proxy_resolver_factory.h"
11 #include "net/proxy/mojo_proxy_resolver_impl.h"
12 #include "net/proxy/proxy_resolver_factory.h"
13 #include "net/proxy/proxy_resolver_mojo.h"
14 #include "net/proxy/proxy_resolver_v8_tracing.h"
15 #include "net/proxy/proxy_service.h"
17 namespace net {
18 namespace {
20 class ProxyResolverFactoryForMojoResolver : public LegacyProxyResolverFactory {
21 public:
22 ProxyResolverFactoryForMojoResolver(
23 MojoProxyResolverFactory* mojo_proxy_factory,
24 HostResolver* host_resolver)
25 : LegacyProxyResolverFactory(true),
26 mojo_proxy_factory_(mojo_proxy_factory),
27 host_resolver_(host_resolver) {}
29 // LegacyProxyResolverFactory override.
30 scoped_ptr<ProxyResolver> CreateProxyResolver() override {
31 return make_scoped_ptr(
32 new ProxyResolverMojo(mojo_proxy_factory_, host_resolver_));
35 private:
36 MojoProxyResolverFactory* const mojo_proxy_factory_;
37 HostResolver* const host_resolver_;
39 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForMojoResolver);
42 } // namespace
44 ProxyService* CreateProxyServiceUsingMojoFactory(
45 MojoProxyResolverFactory* mojo_proxy_factory,
46 ProxyConfigService* proxy_config_service,
47 ProxyScriptFetcher* proxy_script_fetcher,
48 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
49 HostResolver* host_resolver,
50 NetLog* net_log,
51 NetworkDelegate* network_delegate) {
52 DCHECK(proxy_config_service);
53 DCHECK(proxy_script_fetcher);
54 DCHECK(dhcp_proxy_script_fetcher);
55 DCHECK(host_resolver);
57 ProxyService* proxy_service =
58 new ProxyService(proxy_config_service,
59 make_scoped_ptr(new ProxyResolverFactoryForMojoResolver(
60 mojo_proxy_factory, host_resolver)),
61 net_log);
63 // Configure fetchers to use for PAC script downloads and auto-detect.
64 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
65 dhcp_proxy_script_fetcher);
67 return proxy_service;
70 ProxyService* CreateProxyServiceUsingMojoInProcess(
71 ProxyConfigService* proxy_config_service,
72 ProxyScriptFetcher* proxy_script_fetcher,
73 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
74 HostResolver* host_resolver,
75 NetLog* net_log,
76 NetworkDelegate* network_delegate) {
77 return CreateProxyServiceUsingMojoFactory(
78 InProcessMojoProxyResolverFactory::GetInstance(), proxy_config_service,
79 proxy_script_fetcher, dhcp_proxy_script_fetcher, host_resolver, net_log,
80 network_delegate);
83 } // namespace net