1 // Copyright (c) 2012 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_v8.h"
7 #include "base/logging.h"
8 #include "net/proxy/network_delegate_error_observer.h"
9 #include "net/proxy/proxy_resolver.h"
10 #include "net/proxy/proxy_resolver_v8_tracing.h"
11 #include "net/proxy/proxy_service.h"
16 ProxyService
* CreateProxyServiceUsingV8ProxyResolver(
17 ProxyConfigService
* proxy_config_service
,
18 ProxyScriptFetcher
* proxy_script_fetcher
,
19 DhcpProxyScriptFetcher
* dhcp_proxy_script_fetcher
,
20 HostResolver
* host_resolver
,
22 NetworkDelegate
* network_delegate
) {
23 DCHECK(proxy_config_service
);
24 DCHECK(proxy_script_fetcher
);
25 DCHECK(dhcp_proxy_script_fetcher
);
26 DCHECK(host_resolver
);
28 ProxyResolverErrorObserver
* error_observer
= new NetworkDelegateErrorObserver(
29 network_delegate
, base::MessageLoopProxy::current().get());
31 ProxyResolver
* proxy_resolver
=
32 new ProxyResolverV8Tracing(host_resolver
, error_observer
, net_log
);
34 ProxyService
* proxy_service
=
35 new ProxyService(proxy_config_service
, proxy_resolver
, net_log
);
37 // Configure fetchers to use for PAC script downloads and auto-detect.
38 proxy_service
->SetProxyScriptFetchers(proxy_script_fetcher
,
39 dhcp_proxy_script_fetcher
);