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

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, 1 month 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/io_thread.h" 10 #include "chrome/browser/io_thread.h"
11 #include "chrome/browser/net/pref_proxy_config_service.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/public/browser/browser_thread.h" 13 #include "content/public/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 using content::BrowserThread; 25 using content::BrowserThread;
26 26
27 // static 27 // static
28 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( 28 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService() {
29 PrefProxyConfigTracker* proxy_config_tracker) {
30 // The linux gconf-based proxy settings getter relies on being initialized 29 // The linux gconf-based proxy settings getter relies on being initialized
31 // from the UI thread. 30 // from the UI thread.
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 32
34 // Create a baseline service that provides proxy configuration in case nothing
35 // is configured through prefs (Note: prefs include command line and
36 // configuration policy).
37 net::ProxyConfigService* base_service = NULL; 33 net::ProxyConfigService* base_service = NULL;
38 34
35 #if !defined(OS_CHROMEOS)
36 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl
37 // determines the effective proxy config to take effect in the network layer,
38 // be it from prefs or system (which is network flimflam on chromeos).
39
40 // For other platforms, create a baseline service that provides proxy
41 // configuration in case nothing is configured through prefs (Note: prefs
42 // include command line and configuration policy).
43
39 // TODO(port): the IO and FILE message loops are only used by Linux. Can 44 // TODO(port): the IO and FILE message loops are only used by Linux. Can
40 // that code be moved to chrome/browser instead of being in net, so that it 45 // that code be moved to chrome/browser instead of being in net, so that it
41 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. 46 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354.
42 #if defined(OS_CHROMEOS)
43 base_service = new chromeos::ProxyConfigService(
44 g_browser_process->chromeos_proxy_config_service_impl());
45 #else
46 base_service = net::ProxyService::CreateSystemProxyConfigService( 47 base_service = net::ProxyService::CreateSystemProxyConfigService(
47 g_browser_process->io_thread()->message_loop(), 48 g_browser_process->io_thread()->message_loop(),
48 g_browser_process->file_thread()->message_loop()); 49 g_browser_process->file_thread()->message_loop());
50 #endif // !defined(OS_CHROMEOS)
51
52 return new ChromeProxyConfigService(base_service);
53 }
54
55 #if defined(OS_CHROMEOS)
56 // static
57 chromeos::ProxyConfigServiceImpl*
58 ProxyServiceFactory::CreatePrefProxyConfigTracker(
59 PrefService* pref_service) {
60 return new chromeos::ProxyConfigServiceImpl(pref_service);
61 }
62 #else
63 // static
64 PrefProxyConfigTrackerImpl* ProxyServiceFactory::CreatePrefProxyConfigTracker(
65 PrefService* pref_service) {
66 return new PrefProxyConfigTrackerImpl(pref_service);
67 }
49 #endif // defined(OS_CHROMEOS) 68 #endif // defined(OS_CHROMEOS)
50 69
51 return new PrefProxyConfigService(proxy_config_tracker, base_service);
52 }
53
54 // static 70 // static
55 net::ProxyService* ProxyServiceFactory::CreateProxyService( 71 net::ProxyService* ProxyServiceFactory::CreateProxyService(
56 net::NetLog* net_log, 72 net::NetLog* net_log,
57 net::URLRequestContext* context, 73 net::URLRequestContext* context,
58 net::ProxyConfigService* proxy_config_service, 74 net::ProxyConfigService* proxy_config_service,
59 const CommandLine& command_line) { 75 const CommandLine& command_line) {
60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
61 77
62 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); 78 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver);
63 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { 79 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 context->network_delegate()); 116 context->network_delegate());
101 } else { 117 } else {
102 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( 118 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver(
103 proxy_config_service, 119 proxy_config_service,
104 num_pac_threads, 120 num_pac_threads,
105 net_log); 121 net_log);
106 } 122 }
107 123
108 return proxy_service; 124 return proxy_service;
109 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698