Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: net/proxy/proxy_service.cc

Issue 60009: ProxyConfigService for Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_config_service_win_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_util.h" 11 #include "base/string_util.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/proxy/proxy_config_service_fixed.h" 14 #include "net/proxy/proxy_config_service_fixed.h"
15 #include "net/proxy/proxy_script_fetcher.h" 15 #include "net/proxy/proxy_script_fetcher.h"
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include "net/proxy/proxy_config_service_win.h" 17 #include "net/proxy/proxy_config_service_win.h"
18 #include "net/proxy/proxy_resolver_winhttp.h" 18 #include "net/proxy/proxy_resolver_winhttp.h"
19 #elif defined(OS_MACOSX) 19 #elif defined(OS_MACOSX)
20 #include "net/proxy/proxy_resolver_mac.h" 20 #include "net/proxy/proxy_resolver_mac.h"
21 #elif defined(OS_LINUX)
22 #include "net/proxy/proxy_config_service_linux.h"
21 #endif 23 #endif
22 #include "net/proxy/proxy_resolver.h" 24 #include "net/proxy/proxy_resolver.h"
23 #include "net/proxy/proxy_resolver_v8.h" 25 #include "net/proxy/proxy_resolver_v8.h"
24 26
25 using base::TimeDelta; 27 using base::TimeDelta;
26 using base::TimeTicks; 28 using base::TimeTicks;
27 29
28 namespace net { 30 namespace net {
29 31
30 // Config getter that fails every time. 32 // Config getter that fails every time.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // The ProxyResolver is set to NULL, since it should never be called 198 // The ProxyResolver is set to NULL, since it should never be called
197 // (because the configuration will never require PAC). 199 // (because the configuration will never require PAC).
198 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); 200 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL);
199 } 201 }
200 #if defined(OS_WIN) 202 #if defined(OS_WIN)
201 return new ProxyService(new ProxyConfigServiceWin(), 203 return new ProxyService(new ProxyConfigServiceWin(),
202 new ProxyResolverWinHttp()); 204 new ProxyResolverWinHttp());
203 #elif defined(OS_MACOSX) 205 #elif defined(OS_MACOSX)
204 return new ProxyService(new ProxyConfigServiceMac(), 206 return new ProxyService(new ProxyConfigServiceMac(),
205 new ProxyResolverMac()); 207 new ProxyResolverMac());
208 #elif defined(OS_LINUX)
209 // On Linux we use the V8Resolver, no fallback implementation.
210 return CreateNull();
206 #else 211 #else
207 // TODO(port): implement ProxyConfigServiceLinux as well as make use of
208 // ProxyResolverV8 once it's implemented.
209 // See:
210 // - http://code.google.com/p/chromium/issues/detail?id=8143
211 // - http://code.google.com/p/chromium/issues/detail?id=2764
212 return CreateNull(); 212 return CreateNull();
213 #endif 213 #endif
214 } 214 }
215 215
216 // static 216 // static
217 ProxyService* ProxyService::CreateUsingV8Resolver( 217 ProxyService* ProxyService::CreateUsingV8Resolver(
218 const ProxyInfo* pi, URLRequestContext* url_request_context) { 218 const ProxyInfo* pi, URLRequestContext* url_request_context) {
219 if (pi) { 219 if (pi) {
220 // The ProxyResolver is set to NULL, since it should never be called 220 // The ProxyResolver is set to NULL, since it should never be called
221 // (because the configuration will never require PAC). 221 // (because the configuration will never require PAC).
222 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); 222 return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL);
223 } 223 }
224 224
225 // Choose the system configuration service appropriate for each platform. 225 // Choose the system configuration service appropriate for each platform.
226 ProxyConfigService* config_service; 226 ProxyConfigService* config_service;
227 #if defined(OS_WIN) 227 #if defined(OS_WIN)
228 config_service = new ProxyConfigServiceWin(); 228 config_service = new ProxyConfigServiceWin();
229 #elif defined(OS_MACOSX) 229 #elif defined(OS_MACOSX)
230 config_service = new ProxyConfigServiceMac(); 230 config_service = new ProxyConfigServiceMac();
231 #elif defined(OS_LINUX)
232 config_service = new ProxyConfigServiceLinux();
231 #else 233 #else
232 // TODO(port): implement ProxyConfigServiceLinux.
233 // See: http://code.google.com/p/chromium/issues/detail?id=8143
234 return CreateNull(); 234 return CreateNull();
235 #endif 235 #endif
236 236
237 // Create a ProxyService that uses V8 to evaluate PAC scripts. 237 // Create a ProxyService that uses V8 to evaluate PAC scripts.
238 ProxyService* proxy_service = new ProxyService( 238 ProxyService* proxy_service = new ProxyService(
239 config_service, new ProxyResolverV8()); 239 config_service, new ProxyResolverV8());
240 240
241 // Configure PAC script downloads to be issued using |url_request_context|. 241 // Configure PAC script downloads to be issued using |url_request_context|.
242 proxy_service->SetProxyScriptFetcher( 242 proxy_service->SetProxyScriptFetcher(
243 ProxyScriptFetcher::Create(url_request_context)); 243 ProxyScriptFetcher::Create(url_request_context));
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 OnCompletion(result_); 668 OnCompletion(result_);
669 } 669 }
670 } 670 }
671 671
672 void SyncProxyServiceHelper::OnCompletion(int rv) { 672 void SyncProxyServiceHelper::OnCompletion(int rv) {
673 result_ = rv; 673 result_ = rv;
674 event_.Signal(); 674 event_.Signal();
675 } 675 }
676 676
677 } // namespace net 677 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698