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