| 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> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/io_thread.h" | 13 #include "chrome/browser/io_thread.h" |
| 12 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 14 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
| 13 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 15 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
| 16 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 18 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 17 #include "net/proxy/proxy_config_service.h" | 19 #include "net/proxy/proxy_config_service.h" |
| 18 #include "net/proxy/proxy_script_fetcher_impl.h" | 20 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 19 #include "net/proxy/proxy_service.h" | 21 #include "net/proxy/proxy_service.h" |
| 20 #include "net/proxy/proxy_service_v8.h" | 22 #include "net/proxy/proxy_service_v8.h" |
| 21 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
| 22 | 24 |
| 23 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
| 24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 26 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 25 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" | 27 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" |
| 26 #endif // defined(OS_CHROMEOS) | 28 #endif // defined(OS_CHROMEOS) |
| 27 | 29 |
| 28 #if !defined(OS_IOS) | 30 #if !defined(OS_IOS) |
| 29 #include "net/proxy/proxy_resolver_v8.h" | 31 #include "net/proxy/proxy_resolver_v8.h" |
| 30 #endif | 32 #endif |
| 31 | 33 |
| 32 #if !defined(OS_IOS) && !defined(OS_ANDROID) | 34 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
| 35 #include "chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h" |
| 33 #include "net/proxy/proxy_service_mojo.h" | 36 #include "net/proxy/proxy_service_mojo.h" |
| 34 #endif | 37 #endif |
| 35 | 38 |
| 36 using content::BrowserThread; | 39 using content::BrowserThread; |
| 37 | 40 |
| 38 // static | 41 // static |
| 39 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( | 42 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( |
| 40 PrefProxyConfigTracker* tracker) { | 43 PrefProxyConfigTracker* tracker) { |
| 41 // The linux gconf-based proxy settings getter relies on being initialized | 44 // The linux gconf-based proxy settings getter relies on being initialized |
| 42 // from the UI thread. | 45 // from the UI thread. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; | 130 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; |
| 128 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
| 129 dhcp_proxy_script_fetcher = | 132 dhcp_proxy_script_fetcher = |
| 130 new chromeos::DhcpProxyScriptFetcherChromeos(context); | 133 new chromeos::DhcpProxyScriptFetcherChromeos(context); |
| 131 #else | 134 #else |
| 132 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 135 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 133 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 136 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
| 134 #endif | 137 #endif |
| 135 | 138 |
| 136 #if !defined(OS_ANDROID) | 139 #if !defined(OS_ANDROID) |
| 137 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { | 140 if (command_line.HasSwitch(switches::kV8PacMojoOutOfProcess)) { |
| 141 proxy_service = net::CreateProxyServiceUsingMojoFactory( |
| 142 UtilityProcessMojoProxyResolverFactory::GetInstance(), |
| 143 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 144 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, |
| 145 network_delegate); |
| 146 } else if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { |
| 138 proxy_service = net::CreateProxyServiceUsingMojoInProcess( | 147 proxy_service = net::CreateProxyServiceUsingMojoInProcess( |
| 139 proxy_config_service, new net::ProxyScriptFetcherImpl(context), | 148 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 140 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, | 149 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, |
| 141 network_delegate); | 150 network_delegate); |
| 142 } | 151 } |
| 143 #endif // !defined(OS_ANDROID) | 152 #endif // !defined(OS_ANDROID) |
| 144 | 153 |
| 145 if (!proxy_service) { | 154 if (!proxy_service) { |
| 146 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 155 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
| 147 proxy_config_service, new net::ProxyScriptFetcherImpl(context), | 156 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 148 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, | 157 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, |
| 149 network_delegate); | 158 network_delegate); |
| 150 } | 159 } |
| 151 #endif // defined(OS_IOS) | 160 #endif // defined(OS_IOS) |
| 152 } else { | 161 } else { |
| 153 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 162 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 154 proxy_config_service, | 163 proxy_config_service, |
| 155 num_pac_threads, | 164 num_pac_threads, |
| 156 net_log); | 165 net_log); |
| 157 } | 166 } |
| 158 | 167 |
| 159 proxy_service->set_quick_check_enabled(quick_check_enabled); | 168 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 160 | 169 |
| 161 return proxy_service; | 170 return proxy_service; |
| 162 } | 171 } |
| OLD | NEW |