| 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 | |
| 9 #include <string> | 8 #include <string> |
| 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/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 19 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // include command line and configuration policy). | 79 // include command line and configuration policy). |
| 80 | 80 |
| 81 // TODO(port): the IO and FILE message loops are only used by Linux. Can | 81 // TODO(port): the IO and FILE message loops are only used by Linux. Can |
| 82 // that code be moved to chrome/browser instead of being in net, so that it | 82 // that code be moved to chrome/browser instead of being in net, so that it |
| 83 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. | 83 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. |
| 84 base_service = net::ProxyService::CreateSystemProxyConfigService( | 84 base_service = net::ProxyService::CreateSystemProxyConfigService( |
| 85 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 85 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 86 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 86 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 87 #endif // !defined(OS_CHROMEOS) | 87 #endif // !defined(OS_CHROMEOS) |
| 88 | 88 |
| 89 return tracker->CreateTrackingProxyConfigService(base_service.Pass()); | 89 return tracker->CreateTrackingProxyConfigService(std::move(base_service)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // static | 92 // static |
| 93 PrefProxyConfigTracker* | 93 PrefProxyConfigTracker* |
| 94 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 94 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 95 PrefService* profile_prefs, | 95 PrefService* profile_prefs, |
| 96 PrefService* local_state_prefs) { | 96 PrefService* local_state_prefs) { |
| 97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 98 return new chromeos::ProxyConfigServiceImpl(profile_prefs, local_state_prefs); | 98 return new chromeos::ProxyConfigServiceImpl(profile_prefs, local_state_prefs); |
| 99 #else | 99 #else |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 #else | 166 #else |
| 167 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 167 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 168 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 168 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
| 169 #endif | 169 #endif |
| 170 | 170 |
| 171 #if !defined(OS_ANDROID) | 171 #if !defined(OS_ANDROID) |
| 172 // In-process Mojo PAC can only be set on the command line, so its presence | 172 // In-process Mojo PAC can only be set on the command line, so its presence |
| 173 // should override other options. | 173 // should override other options. |
| 174 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { | 174 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { |
| 175 proxy_service = net::CreateProxyServiceUsingMojoInProcess( | 175 proxy_service = net::CreateProxyServiceUsingMojoInProcess( |
| 176 proxy_config_service.Pass(), new net::ProxyScriptFetcherImpl(context), | 176 std::move(proxy_config_service), |
| 177 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, | 177 new net::ProxyScriptFetcherImpl(context), |
| 178 network_delegate); | 178 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), |
| 179 net_log, network_delegate); |
| 179 } else if (EnableOutOfProcessV8Pac(command_line)) { | 180 } else if (EnableOutOfProcessV8Pac(command_line)) { |
| 180 proxy_service = net::CreateProxyServiceUsingMojoFactory( | 181 proxy_service = net::CreateProxyServiceUsingMojoFactory( |
| 181 UtilityProcessMojoProxyResolverFactory::GetInstance(), | 182 UtilityProcessMojoProxyResolverFactory::GetInstance(), |
| 182 proxy_config_service.Pass(), new net::ProxyScriptFetcherImpl(context), | 183 std::move(proxy_config_service), |
| 183 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, | 184 new net::ProxyScriptFetcherImpl(context), |
| 184 network_delegate); | 185 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), |
| 186 net_log, network_delegate); |
| 185 } | 187 } |
| 186 #endif // !defined(OS_ANDROID) | 188 #endif // !defined(OS_ANDROID) |
| 187 | 189 |
| 188 if (!proxy_service) { | 190 if (!proxy_service) { |
| 189 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 191 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
| 190 proxy_config_service.Pass(), new net::ProxyScriptFetcherImpl(context), | 192 std::move(proxy_config_service), |
| 191 dhcp_proxy_script_fetcher.Pass(), context->host_resolver(), net_log, | 193 new net::ProxyScriptFetcherImpl(context), |
| 192 network_delegate); | 194 std::move(dhcp_proxy_script_fetcher), context->host_resolver(), |
| 195 net_log, network_delegate); |
| 193 } | 196 } |
| 194 #endif // defined(OS_IOS) | 197 #endif // defined(OS_IOS) |
| 195 } else { | 198 } else { |
| 196 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 199 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 197 proxy_config_service.Pass(), num_pac_threads, net_log); | 200 std::move(proxy_config_service), num_pac_threads, net_log); |
| 198 } | 201 } |
| 199 | 202 |
| 200 proxy_service->set_quick_check_enabled(quick_check_enabled); | 203 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 201 | 204 |
| 202 return proxy_service; | 205 return proxy_service; |
| 203 } | 206 } |
| OLD | NEW |