OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_tokenizer.h" | 11 #include "base/string_tokenizer.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/proxy/proxy_config_service_fixed.h" | 15 #include "net/proxy/proxy_config_service_fixed.h" |
16 #include "net/proxy/proxy_script_fetcher.h" | 16 #include "net/proxy/proxy_script_fetcher.h" |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "net/proxy/proxy_config_service_win.h" | 18 #include "net/proxy/proxy_config_service_win.h" |
19 #include "net/proxy/proxy_resolver_winhttp.h" | 19 #include "net/proxy/proxy_resolver_winhttp.h" |
20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
21 #include "net/proxy/proxy_resolver_mac.h" | 21 #include "net/proxy/proxy_resolver_mac.h" |
| 22 #elif defined(OS_LINUX) |
| 23 #include "net/proxy/proxy_config_service_linux.h" |
22 #endif | 24 #endif |
23 #include "net/proxy/proxy_resolver.h" | 25 #include "net/proxy/proxy_resolver.h" |
24 #include "net/proxy/proxy_resolver_v8.h" | 26 #include "net/proxy/proxy_resolver_v8.h" |
25 | 27 |
26 using base::TimeDelta; | 28 using base::TimeDelta; |
27 using base::TimeTicks; | 29 using base::TimeTicks; |
28 | 30 |
29 namespace net { | 31 namespace net { |
30 | 32 |
31 // Config getter that fails every time. | 33 // Config getter that fails every time. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // (because the configuration will never require PAC). | 200 // (because the configuration will never require PAC). |
199 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); | 201 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); |
200 } | 202 } |
201 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
202 return new ProxyService(new ProxyConfigServiceWin(), | 204 return new ProxyService(new ProxyConfigServiceWin(), |
203 new ProxyResolverWinHttp()); | 205 new ProxyResolverWinHttp()); |
204 #elif defined(OS_MACOSX) | 206 #elif defined(OS_MACOSX) |
205 return new ProxyService(new ProxyConfigServiceMac(), | 207 return new ProxyService(new ProxyConfigServiceMac(), |
206 new ProxyResolverMac()); | 208 new ProxyResolverMac()); |
207 #else | 209 #else |
208 // TODO(port): implement ProxyConfigServiceLinux as well as make use of | 210 return new ProxyService(new ProxyConfigServiceLinux(), |
209 // ProxyResolverV8 once it's implemented. | 211 new ProxyResolverV8()); |
210 // See: | |
211 // - http://code.google.com/p/chromium/issues/detail?id=8143 | |
212 // - http://code.google.com/p/chromium/issues/detail?id=2764 | |
213 return CreateNull(); | |
214 #endif | 212 #endif |
215 } | 213 } |
216 | 214 |
217 // static | 215 // static |
218 ProxyService* ProxyService::CreateUsingV8Resolver( | 216 ProxyService* ProxyService::CreateUsingV8Resolver( |
219 const ProxyInfo* pi, URLRequestContext* url_request_context) { | 217 const ProxyInfo* pi, URLRequestContext* url_request_context) { |
220 if (pi) { | 218 if (pi) { |
221 // The ProxyResolver is set to NULL, since it should never be called | 219 // The ProxyResolver is set to NULL, since it should never be called |
222 // (because the configuration will never require PAC). | 220 // (because the configuration will never require PAC). |
223 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); | 221 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); |
224 } | 222 } |
225 | 223 |
226 // Choose the system configuration service appropriate for each platform. | 224 // Choose the system configuration service appropriate for each platform. |
227 ProxyConfigService* config_service; | 225 ProxyConfigService* config_service; |
228 #if defined(OS_WIN) | 226 #if defined(OS_WIN) |
229 config_service = new ProxyConfigServiceWin(); | 227 config_service = new ProxyConfigServiceWin(); |
230 #elif defined(OS_MACOSX) | 228 #elif defined(OS_MACOSX) |
231 config_service = new ProxyConfigServiceMac(); | 229 config_service = new ProxyConfigServiceMac(); |
232 #else | 230 #else |
233 // TODO(port): implement ProxyConfigServiceLinux. | 231 config_service = new ProxyConfigServiceLinux(); |
234 // See: http://code.google.com/p/chromium/issues/detail?id=8143 | |
235 return CreateNull(); | |
236 #endif | 232 #endif |
237 | 233 |
238 // Create a ProxyService that uses V8 to evaluate PAC scripts. | 234 // Create a ProxyService that uses V8 to evaluate PAC scripts. |
239 ProxyService* proxy_service = new ProxyService( | 235 ProxyService* proxy_service = new ProxyService( |
240 config_service, new ProxyResolverV8()); | 236 config_service, new ProxyResolverV8()); |
241 | 237 |
242 // Configure PAC script downloads to be issued using |url_request_context|. | 238 // Configure PAC script downloads to be issued using |url_request_context|. |
243 proxy_service->SetProxyScriptFetcher( | 239 proxy_service->SetProxyScriptFetcher( |
244 ProxyScriptFetcher::Create(url_request_context)); | 240 ProxyScriptFetcher::Create(url_request_context)); |
245 | 241 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 OnCompletion(result_); | 657 OnCompletion(result_); |
662 } | 658 } |
663 } | 659 } |
664 | 660 |
665 void SyncProxyServiceHelper::OnCompletion(int rv) { | 661 void SyncProxyServiceHelper::OnCompletion(int rv) { |
666 result_ = rv; | 662 result_ = rv; |
667 event_.Signal(); | 663 event_.Signal(); |
668 } | 664 } |
669 | 665 |
670 } // namespace net | 666 } // namespace net |
OLD | NEW |