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

Side by Side Diff: chrome/browser/net/proxy_service_factory.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/net/pref_proxy_config_service.h"
11 #include "chrome/browser/io_thread.h" 10 #include "chrome/browser/io_thread.h"
11 #include "chrome/browser/net/pref_proxy_config_tracker.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "content/browser/browser_thread.h" 13 #include "content/browser/browser_thread.h"
14 #include "net/base/net_log.h" 14 #include "net/base/net_log.h"
15 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" 15 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
16 #include "net/proxy/proxy_config_service.h" 16 #include "net/proxy/proxy_config_service.h"
17 #include "net/proxy/proxy_script_fetcher_impl.h" 17 #include "net/proxy/proxy_script_fetcher_impl.h"
18 #include "net/proxy/proxy_service.h" 18 #include "net/proxy/proxy_service.h"
19 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/proxy_config_service.h" 22 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
23 #endif // defined(OS_CHROMEOS) 23 #endif // defined(OS_CHROMEOS)
24 24
25 // static 25 // static
26 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( 26 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService() {
27 PrefProxyConfigTracker* proxy_config_tracker) {
28 // The linux gconf-based proxy settings getter relies on being initialized 27 // The linux gconf-based proxy settings getter relies on being initialized
29 // from the UI thread. 28 // from the UI thread.
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
31 30
32 // Create a baseline service that provides proxy configuration in case nothing
33 // is configured through prefs (Note: prefs include command line and
34 // configuration policy).
35 net::ProxyConfigService* base_service = NULL; 31 net::ProxyConfigService* base_service = NULL;
36 32
33 #if !defined(OS_CHROMEOS)
34 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl
35 // determines the effective proxy config to take effect in the network layer,
36 // be it from prefs or system (which is network flimflam on chromeos).
37
38 // For other platforms, create a baseline service that provides proxy
39 // configuration in case nothing is configured through prefs (Note: prefs
40 // include command line and configuration policy).
41
37 // TODO(port): the IO and FILE message loops are only used by Linux. Can 42 // TODO(port): the IO and FILE message loops are only used by Linux. Can
38 // that code be moved to chrome/browser instead of being in net, so that it 43 // that code be moved to chrome/browser instead of being in net, so that it
39 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. 44 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354.
40 #if defined(OS_CHROMEOS)
41 base_service = new chromeos::ProxyConfigService(
42 g_browser_process->chromeos_proxy_config_service_impl());
43 #else
44 base_service = net::ProxyService::CreateSystemProxyConfigService( 45 base_service = net::ProxyService::CreateSystemProxyConfigService(
45 g_browser_process->io_thread()->message_loop(), 46 g_browser_process->io_thread()->message_loop(),
46 g_browser_process->file_thread()->message_loop()); 47 g_browser_process->file_thread()->message_loop());
48 #endif // !defined(OS_CHROMEOS)
49
50 return new ChromeProxyConfigService(base_service);
51 }
52
53 // static
Mattias Nissler (ping if slow) 2011/10/19 17:03:42 I'd rather put the // static next to the declarati
kuan 2011/10/20 00:41:11 Done.
54 #if defined(OS_CHROMEOS)
55 chromeos::ProxyConfigServiceImpl*
56 ProxyServiceFactory::CreatePrefProxyConfigTracker(
57 PrefService* pref_service) {
58 return new chromeos::ProxyConfigServiceImpl(pref_service);
59 }
60 #else
61 PrefProxyConfigTracker* ProxyServiceFactory::CreatePrefProxyConfigTracker(
62 PrefService* pref_service) {
63 return new PrefProxyConfigTracker(pref_service);
64 }
47 #endif // defined(OS_CHROMEOS) 65 #endif // defined(OS_CHROMEOS)
48 66
49 return new PrefProxyConfigService(proxy_config_tracker, base_service);
50 }
51
52 // static 67 // static
53 net::ProxyService* ProxyServiceFactory::CreateProxyService( 68 net::ProxyService* ProxyServiceFactory::CreateProxyService(
54 net::NetLog* net_log, 69 net::NetLog* net_log,
55 net::URLRequestContext* context, 70 net::URLRequestContext* context,
56 net::ProxyConfigService* proxy_config_service, 71 net::ProxyConfigService* proxy_config_service,
57 const CommandLine& command_line) { 72 const CommandLine& command_line) {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
59 74
60 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); 75 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver);
61 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { 76 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 context->network_delegate()); 113 context->network_delegate());
99 } else { 114 } else {
100 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( 115 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver(
101 proxy_config_service, 116 proxy_config_service,
102 num_pac_threads, 117 num_pac_threads,
103 net_log); 118 net_log);
104 } 119 }
105 120
106 return proxy_service; 121 return proxy_service;
107 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698