| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #include "net/url_request/url_request_context_builder_mojo.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" |
| 9 #include "net/proxy/proxy_config_service.h" |
| 10 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 11 #include "net/proxy/proxy_service_mojo.h" |
| 12 |
| 13 namespace net { |
| 14 |
| 15 URLRequestContextBuilderMojo::URLRequestContextBuilderMojo() |
| 16 : dhcp_fetcher_factory_(new DhcpProxyScriptFetcherFactory()) {} |
| 17 |
| 18 URLRequestContextBuilderMojo::~URLRequestContextBuilderMojo() = default; |
| 19 |
| 20 std::unique_ptr<ProxyService> URLRequestContextBuilderMojo::CreateProxyService( |
| 21 std::unique_ptr<ProxyConfigService> proxy_config_service, |
| 22 URLRequestContext* url_request_context, |
| 23 HostResolver* host_resolver, |
| 24 NetworkDelegate* network_delegate, |
| 25 NetLog* net_log) { |
| 26 DCHECK(url_request_context); |
| 27 DCHECK(host_resolver); |
| 28 |
| 29 if (!mojo_proxy_resolver_factory_) { |
| 30 return URLRequestContextBuilder::CreateProxyService( |
| 31 std::move(proxy_config_service), url_request_context, host_resolver, |
| 32 network_delegate, net_log); |
| 33 } |
| 34 |
| 35 std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher = |
| 36 dhcp_fetcher_factory_->Create(url_request_context); |
| 37 std::unique_ptr<net::ProxyScriptFetcher> proxy_script_fetcher = |
| 38 base::MakeUnique<ProxyScriptFetcherImpl>(url_request_context); |
| 39 return CreateProxyServiceUsingMojoFactory( |
| 40 mojo_proxy_resolver_factory_, std::move(proxy_config_service), |
| 41 proxy_script_fetcher.release(), std::move(dhcp_proxy_script_fetcher), |
| 42 host_resolver, net_log, network_delegate); |
| 43 } |
| 44 |
| 45 } // namespace net |
| OLD | NEW |