Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / proxy / proxy_service_mojo.cc
blob689b870e6de3164e9a26e525ced1e8034c52812b
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 "base/thread_task_runner_handle.h"
9 #include "net/dns/mojo_host_resolver_impl.h"
10 #include "net/interfaces/proxy_resolver_service.mojom.h"
11 #include "net/proxy/in_process_mojo_proxy_resolver_factory.h"
12 #include "net/proxy/mojo_proxy_resolver_factory.h"
13 #include "net/proxy/mojo_proxy_resolver_impl.h"
14 #include "net/proxy/network_delegate_error_observer.h"
15 #include "net/proxy/proxy_resolver_factory.h"
16 #include "net/proxy/proxy_resolver_factory_mojo.h"
17 #include "net/proxy/proxy_resolver_v8_tracing.h"
18 #include "net/proxy/proxy_service.h"
20 namespace net {
22 ProxyService* CreateProxyServiceUsingMojoFactory(
23 MojoProxyResolverFactory* mojo_proxy_factory,
24 ProxyConfigService* proxy_config_service,
25 ProxyScriptFetcher* proxy_script_fetcher,
26 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
27 HostResolver* host_resolver,
28 NetLog* net_log,
29 NetworkDelegate* network_delegate) {
30 DCHECK(proxy_config_service);
31 DCHECK(proxy_script_fetcher);
32 DCHECK(dhcp_proxy_script_fetcher);
33 DCHECK(host_resolver);
35 ProxyService* proxy_service = new ProxyService(
36 proxy_config_service,
37 make_scoped_ptr(new ProxyResolverFactoryMojo(
38 mojo_proxy_factory, host_resolver,
39 base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate,
40 base::ThreadTaskRunnerHandle::Get()),
41 net_log)),
42 net_log);
44 // Configure fetchers to use for PAC script downloads and auto-detect.
45 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
46 dhcp_proxy_script_fetcher);
48 return proxy_service;
51 ProxyService* CreateProxyServiceUsingMojoInProcess(
52 ProxyConfigService* proxy_config_service,
53 ProxyScriptFetcher* proxy_script_fetcher,
54 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
55 HostResolver* host_resolver,
56 NetLog* net_log,
57 NetworkDelegate* network_delegate) {
58 return CreateProxyServiceUsingMojoFactory(
59 InProcessMojoProxyResolverFactory::GetInstance(), proxy_config_service,
60 proxy_script_fetcher, dhcp_proxy_script_fetcher, host_resolver, net_log,
61 network_delegate);
64 } // namespace net