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 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; | 152 std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; |
153 #if defined(OS_CHROMEOS) | 153 #if defined(OS_CHROMEOS) |
154 dhcp_proxy_script_fetcher.reset( | 154 dhcp_proxy_script_fetcher.reset( |
155 new chromeos::DhcpProxyScriptFetcherChromeos(context)); | 155 new chromeos::DhcpProxyScriptFetcherChromeos(context)); |
156 #else | 156 #else |
157 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 157 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
158 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 158 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
159 #endif | 159 #endif |
160 | 160 |
161 #if !defined(OS_ANDROID) | 161 #if !defined(OS_ANDROID) |
162 // In-process Mojo PAC can only be set on the command line, so its presence | 162 if (EnableOutOfProcessV8Pac(command_line)) { |
163 // should override other options. | |
164 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { | |
165 proxy_service = net::CreateProxyServiceUsingMojoInProcess( | |
166 std::move(proxy_config_service), | |
167 new net::ProxyScriptFetcherImpl(context), | |
168 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), | |
169 net_log, network_delegate); | |
170 } else if (EnableOutOfProcessV8Pac(command_line)) { | |
171 proxy_service = net::CreateProxyServiceUsingMojoFactory( | 163 proxy_service = net::CreateProxyServiceUsingMojoFactory( |
172 UtilityProcessMojoProxyResolverFactory::GetInstance(), | 164 UtilityProcessMojoProxyResolverFactory::GetInstance(), |
173 std::move(proxy_config_service), | 165 std::move(proxy_config_service), |
174 new net::ProxyScriptFetcherImpl(context), | 166 new net::ProxyScriptFetcherImpl(context), |
175 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), | 167 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), |
176 net_log, network_delegate); | 168 net_log, network_delegate); |
177 } | 169 } |
178 #endif // !defined(OS_ANDROID) | 170 #endif // !defined(OS_ANDROID) |
179 | 171 |
180 if (!proxy_service) { | 172 if (!proxy_service) { |
181 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 173 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
182 std::move(proxy_config_service), | 174 std::move(proxy_config_service), |
183 new net::ProxyScriptFetcherImpl(context), | 175 new net::ProxyScriptFetcherImpl(context), |
184 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), | 176 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), |
185 net_log, network_delegate); | 177 net_log, network_delegate); |
186 } | 178 } |
187 } else { | 179 } else { |
188 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 180 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
189 std::move(proxy_config_service), num_pac_threads, net_log); | 181 std::move(proxy_config_service), num_pac_threads, net_log); |
190 } | 182 } |
191 | 183 |
192 proxy_service->set_quick_check_enabled(quick_check_enabled); | 184 proxy_service->set_quick_check_enabled(quick_check_enabled); |
193 proxy_service->set_sanitize_url_policy( | 185 proxy_service->set_sanitize_url_policy( |
194 pac_https_url_stripping_enabled | 186 pac_https_url_stripping_enabled |
195 ? net::ProxyService::SanitizeUrlPolicy::SAFE | 187 ? net::ProxyService::SanitizeUrlPolicy::SAFE |
196 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); | 188 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); |
197 | 189 |
198 return proxy_service; | 190 return proxy_service; |
199 } | 191 } |
OLD | NEW |