| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } else { | 145 } else { |
| 146 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; | 146 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 net::ProxyService* proxy_service = NULL; | 150 net::ProxyService* proxy_service = NULL; |
| 151 if (use_v8) { | 151 if (use_v8) { |
| 152 #if defined(OS_IOS) | 152 #if defined(OS_IOS) |
| 153 NOTREACHED(); | 153 NOTREACHED(); |
| 154 #else | 154 #else |
| 155 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; | 155 scoped_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; |
| 156 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 157 dhcp_proxy_script_fetcher = | 157 dhcp_proxy_script_fetcher.reset( |
| 158 new chromeos::DhcpProxyScriptFetcherChromeos(context); | 158 new chromeos::DhcpProxyScriptFetcherChromeos(context)); |
| 159 #else | 159 #else |
| 160 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 160 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 161 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 161 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
| 162 #endif | 162 #endif |
| 163 | 163 |
| 164 #if !defined(OS_ANDROID) | 164 #if !defined(OS_ANDROID) |
| 165 // In-process Mojo PAC can only be set on the command line, so its presence | 165 // In-process Mojo PAC can only be set on the command line, so its presence |
| 166 // should override other options. | 166 // should override other options. |
| 167 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { | 167 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { |
| 168 proxy_service = net::CreateProxyServiceUsingMojoInProcess( | 168 proxy_service = net::CreateProxyServiceUsingMojoInProcess( |
| 169 proxy_config_service, new net::ProxyScriptFetcherImpl(context), | 169 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 170 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, | 170 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, |
| 171 network_delegate); | 171 network_delegate); |
| 172 } else if (EnableOutOfProcessV8Pac(command_line)) { | 172 } else if (EnableOutOfProcessV8Pac(command_line)) { |
| 173 proxy_service = net::CreateProxyServiceUsingMojoFactory( | 173 proxy_service = net::CreateProxyServiceUsingMojoFactory( |
| 174 UtilityProcessMojoProxyResolverFactory::GetInstance(), | 174 UtilityProcessMojoProxyResolverFactory::GetInstance(), |
| 175 proxy_config_service, new net::ProxyScriptFetcherImpl(context), | 175 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 176 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, | 176 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, |
| 177 network_delegate); | 177 network_delegate); |
| 178 } | 178 } |
| 179 #endif // !defined(OS_ANDROID) | 179 #endif // !defined(OS_ANDROID) |
| 180 | 180 |
| 181 if (!proxy_service) { | 181 if (!proxy_service) { |
| 182 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 182 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
| 183 proxy_config_service, new net::ProxyScriptFetcherImpl(context), | 183 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 184 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, | 184 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, |
| 185 network_delegate); | 185 network_delegate); |
| 186 } | 186 } |
| 187 #endif // defined(OS_IOS) | 187 #endif // defined(OS_IOS) |
| 188 } else { | 188 } else { |
| 189 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 189 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 190 proxy_config_service, | 190 proxy_config_service, |
| 191 num_pac_threads, | 191 num_pac_threads, |
| 192 net_log); | 192 net_log); |
| 193 } | 193 } |
| 194 | 194 |
| 195 proxy_service->set_quick_check_enabled(quick_check_enabled); | 195 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 196 | 196 |
| 197 return proxy_service; | 197 return proxy_service; |
| 198 } | 198 } |
| OLD | NEW |