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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
25 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" | 25 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" |
26 #endif // defined(OS_CHROMEOS) | 26 #endif // defined(OS_CHROMEOS) |
27 | 27 |
28 #if !defined(OS_IOS) | 28 #if !defined(OS_IOS) |
29 #include "net/proxy/proxy_resolver_v8.h" | 29 #include "net/proxy/proxy_resolver_v8.h" |
30 #endif | 30 #endif |
31 | 31 |
| 32 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
| 33 #include "net/proxy/proxy_service_mojo.h" |
| 34 #endif |
| 35 |
32 using content::BrowserThread; | 36 using content::BrowserThread; |
33 | 37 |
34 // static | 38 // static |
35 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( | 39 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( |
36 PrefProxyConfigTracker* tracker) { | 40 PrefProxyConfigTracker* tracker) { |
37 // The linux gconf-based proxy settings getter relies on being initialized | 41 // The linux gconf-based proxy settings getter relies on being initialized |
38 // from the UI thread. | 42 // from the UI thread. |
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
40 | 44 |
41 scoped_ptr<net::ProxyConfigService> base_service; | 45 scoped_ptr<net::ProxyConfigService> base_service; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #else | 126 #else |
123 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; | 127 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; |
124 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
125 dhcp_proxy_script_fetcher = | 129 dhcp_proxy_script_fetcher = |
126 new chromeos::DhcpProxyScriptFetcherChromeos(context); | 130 new chromeos::DhcpProxyScriptFetcherChromeos(context); |
127 #else | 131 #else |
128 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 132 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
129 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 133 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
130 #endif | 134 #endif |
131 | 135 |
132 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 136 #if !defined(OS_ANDROID) |
133 proxy_config_service, | 137 if (command_line.HasSwitch(switches::kV8PacMojoInProcess)) { |
134 new net::ProxyScriptFetcherImpl(context), | 138 proxy_service = net::CreateProxyServiceUsingMojoInProcess( |
135 dhcp_proxy_script_fetcher, | 139 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
136 context->host_resolver(), | 140 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, |
137 net_log, | 141 network_delegate); |
138 network_delegate); | 142 } |
| 143 #endif // !defined(OS_ANDROID) |
| 144 |
| 145 if (!proxy_service) { |
| 146 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
| 147 proxy_config_service, new net::ProxyScriptFetcherImpl(context), |
| 148 dhcp_proxy_script_fetcher, context->host_resolver(), net_log, |
| 149 network_delegate); |
| 150 } |
139 #endif // defined(OS_IOS) | 151 #endif // defined(OS_IOS) |
140 } else { | 152 } else { |
141 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 153 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
142 proxy_config_service, | 154 proxy_config_service, |
143 num_pac_threads, | 155 num_pac_threads, |
144 net_log); | 156 net_log); |
145 } | 157 } |
146 | 158 |
147 proxy_service->set_quick_check_enabled(quick_check_enabled); | 159 proxy_service->set_quick_check_enabled(quick_check_enabled); |
148 | 160 |
149 return proxy_service; | 161 return proxy_service; |
150 } | 162 } |
OLD | NEW |