| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/proxy_service_factory.h" | 5 #include "chrome/browser/net/proxy_service_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/io_thread.h" | 17 #include "chrome/browser/io_thread.h" |
| 18 #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 20 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 22 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 23 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 23 #include "net/proxy/proxy_config_service.h" | 24 #include "net/proxy/proxy_config_service.h" |
| 24 #include "net/proxy/proxy_resolver_v8.h" | |
| 25 #include "net/proxy/proxy_script_fetcher_impl.h" | 25 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 26 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 27 #include "net/proxy/proxy_service_v8.h" | 27 #include "net/proxy/proxy_service_mojo.h" |
| 28 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" | 31 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" |
| 32 #include "chromeos/network/proxy/proxy_config_service_impl.h" | 32 #include "chromeos/network/proxy/proxy_config_service_impl.h" |
| 33 #endif // defined(OS_CHROMEOS) | 33 #endif // defined(OS_CHROMEOS) |
| 34 | 34 |
| 35 #if !defined(OS_ANDROID) | |
| 36 #include "chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h" | |
| 37 #include "net/proxy/proxy_service_mojo.h" | |
| 38 #endif | |
| 39 | |
| 40 using content::BrowserThread; | 35 using content::BrowserThread; |
| 41 | 36 |
| 42 // static | 37 // static |
| 43 std::unique_ptr<net::ProxyConfigService> | 38 std::unique_ptr<net::ProxyConfigService> |
| 44 ProxyServiceFactory::CreateProxyConfigService(PrefProxyConfigTracker* tracker) { | 39 ProxyServiceFactory::CreateProxyConfigService(PrefProxyConfigTracker* tracker) { |
| 45 // The linux gconf-based proxy settings getter relies on being initialized | 40 // The linux gconf-based proxy settings getter relies on being initialized |
| 46 // from the UI thread. | 41 // from the UI thread. |
| 47 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 42 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 48 | 43 |
| 49 std::unique_ptr<net::ProxyConfigService> base_service; | 44 std::unique_ptr<net::ProxyConfigService> base_service; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if (use_v8) { | 116 if (use_v8) { |
| 122 std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; | 117 std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; |
| 123 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
| 124 dhcp_proxy_script_fetcher.reset( | 119 dhcp_proxy_script_fetcher.reset( |
| 125 new chromeos::DhcpProxyScriptFetcherChromeos(context)); | 120 new chromeos::DhcpProxyScriptFetcherChromeos(context)); |
| 126 #else | 121 #else |
| 127 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 122 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 128 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 123 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
| 129 #endif | 124 #endif |
| 130 | 125 |
| 131 #if !defined(OS_ANDROID) | |
| 132 proxy_service = net::CreateProxyServiceUsingMojoFactory( | 126 proxy_service = net::CreateProxyServiceUsingMojoFactory( |
| 133 UtilityProcessMojoProxyResolverFactory::GetInstance(), | 127 ChromeMojoProxyResolverFactory::GetInstance(), |
| 134 std::move(proxy_config_service), | 128 std::move(proxy_config_service), |
| 135 new net::ProxyScriptFetcherImpl(context), | 129 new net::ProxyScriptFetcherImpl(context), |
| 136 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, | 130 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, |
| 137 network_delegate); | 131 network_delegate); |
| 138 #else | |
| 139 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | |
| 140 std::move(proxy_config_service), | |
| 141 new net::ProxyScriptFetcherImpl(context), | |
| 142 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, | |
| 143 network_delegate); | |
| 144 #endif // !defined(OS_ANDROID) | |
| 145 } else { | 132 } else { |
| 146 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 133 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 147 std::move(proxy_config_service), net_log); | 134 std::move(proxy_config_service), net_log); |
| 148 } | 135 } |
| 149 | 136 |
| 150 proxy_service->set_quick_check_enabled(quick_check_enabled); | 137 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 151 proxy_service->set_sanitize_url_policy( | 138 proxy_service->set_sanitize_url_policy( |
| 152 pac_https_url_stripping_enabled | 139 pac_https_url_stripping_enabled |
| 153 ? net::ProxyService::SanitizeUrlPolicy::SAFE | 140 ? net::ProxyService::SanitizeUrlPolicy::SAFE |
| 154 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); | 141 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); |
| 155 | 142 |
| 156 return proxy_service; | 143 return proxy_service; |
| 157 } | 144 } |
| OLD | NEW |