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

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

Issue 3047052: chromeos: 1st draft of ProxyConfigService for chromeos... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome/browser/chromeos/proxy_config_service_impl_unittest.cc ('k') | chrome/browser/profile.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chrome_url_request_context.h" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 22 matching lines...) Expand all
33 #include "net/proxy/proxy_config_service_fixed.h" 33 #include "net/proxy/proxy_config_service_fixed.h"
34 #include "net/proxy/proxy_script_fetcher.h" 34 #include "net/proxy/proxy_script_fetcher.h"
35 #include "net/proxy/proxy_service.h" 35 #include "net/proxy/proxy_service.h"
36 #include "net/url_request/url_request.h" 36 #include "net/url_request/url_request.h"
37 #include "webkit/glue/webkit_glue.h" 37 #include "webkit/glue/webkit_glue.h"
38 38
39 #if defined(USE_NSS) 39 #if defined(USE_NSS)
40 #include "net/ocsp/nss_ocsp.h" 40 #include "net/ocsp/nss_ocsp.h"
41 #endif 41 #endif
42 42
43 #if defined(OS_CHROMEOS)
44 #include "chrome/browser/chromeos/proxy_config_service.h"
45 #endif // defined(OS_CHROMEOS)
46
43 namespace { 47 namespace {
44 48
45 // ---------------------------------------------------------------------------- 49 // ----------------------------------------------------------------------------
46 // Helper methods to check current thread 50 // Helper methods to check current thread
47 // ---------------------------------------------------------------------------- 51 // ----------------------------------------------------------------------------
48 52
49 void CheckCurrentlyOnIOThread() { 53 void CheckCurrentlyOnIOThread() {
50 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 54 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
51 } 55 }
52 56
53 void CheckCurrentlyOnMainThread() { 57 void CheckCurrentlyOnMainThread() {
54 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 58 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
55 } 59 }
56 60
57 // ---------------------------------------------------------------------------- 61 // ----------------------------------------------------------------------------
58 // Helper methods to initialize proxy 62 // Helper methods to initialize proxy
59 // ---------------------------------------------------------------------------- 63 // ----------------------------------------------------------------------------
60 64
61 net::ProxyConfigService* CreateProxyConfigService( 65 net::ProxyConfigService* CreateProxyConfigService(Profile* profile) {
62 const PrefService* pref_service) {
63 // The linux gconf-based proxy settings getter relies on being initialized 66 // The linux gconf-based proxy settings getter relies on being initialized
64 // from the UI thread. 67 // from the UI thread.
65 CheckCurrentlyOnMainThread(); 68 CheckCurrentlyOnMainThread();
66 69
67 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(pref_service)); 70 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(
71 profile->GetPrefs()));
68 72
69 if (!proxy_config.get()) { 73 if (!proxy_config.get()) {
70 // Use system settings. 74 // Use system settings.
71 // TODO(port): the IO and FILE message loops are only used by Linux. Can 75 // TODO(port): the IO and FILE message loops are only used by Linux. Can
72 // that code be moved to chrome/browser instead of being in net, so that it 76 // that code be moved to chrome/browser instead of being in net, so that it
73 // can use ChromeThread instead of raw MessageLoop pointers? See bug 25354. 77 // can use ChromeThread instead of raw MessageLoop pointers? See bug 25354.
78 #if defined(OS_CHROMEOS)
79 return new chromeos::ProxyConfigService(
80 profile->GetChromeOSProxyConfigServiceImpl());
81 #else
74 return net::ProxyService::CreateSystemProxyConfigService( 82 return net::ProxyService::CreateSystemProxyConfigService(
75 g_browser_process->io_thread()->message_loop(), 83 g_browser_process->io_thread()->message_loop(),
76 g_browser_process->file_thread()->message_loop()); 84 g_browser_process->file_thread()->message_loop());
85 #endif // defined(OS_CHROMEOS)
77 } 86 }
78 87
79 // Otherwise use the fixed settings from the command line. 88 // Otherwise use the fixed settings from the command line.
80 return new net::ProxyConfigServiceFixed(*proxy_config.get()); 89 return new net::ProxyConfigServiceFixed(*proxy_config.get());
81 } 90 }
82 91
83 // Create a proxy service according to the options on command line. 92 // Create a proxy service according to the options on command line.
84 net::ProxyService* CreateProxyService( 93 net::ProxyService* CreateProxyService(
85 net::NetLog* net_log, 94 net::NetLog* net_log,
86 URLRequestContext* context, 95 URLRequestContext* context,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const FilePath& cookie_store_path, 227 const FilePath& cookie_store_path,
219 const FilePath& disk_cache_path, 228 const FilePath& disk_cache_path,
220 int cache_size) 229 int cache_size)
221 : ChromeURLRequestContextFactory(profile), 230 : ChromeURLRequestContextFactory(profile),
222 cookie_store_path_(cookie_store_path), 231 cookie_store_path_(cookie_store_path),
223 disk_cache_path_(disk_cache_path), 232 disk_cache_path_(disk_cache_path),
224 cache_size_(cache_size), 233 cache_size_(cache_size),
225 // We need to initialize the ProxyConfigService from the UI thread 234 // We need to initialize the ProxyConfigService from the UI thread
226 // because on linux it relies on initializing things through gconf, 235 // because on linux it relies on initializing things through gconf,
227 // and needs to be on the main thread. 236 // and needs to be on the main thread.
228 proxy_config_service_(CreateProxyConfigService(profile->GetPrefs())) { 237 proxy_config_service_(CreateProxyConfigService(profile)) {
229 } 238 }
230 239
231 virtual ChromeURLRequestContext* Create(); 240 virtual ChromeURLRequestContext* Create();
232 241
233 private: 242 private:
234 FilePath cookie_store_path_; 243 FilePath cookie_store_path_;
235 FilePath disk_cache_path_; 244 FilePath disk_cache_path_;
236 int cache_size_; 245 int cache_size_;
237 246
238 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 247 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 prefs::kProxyAutoDetect)); 1060 prefs::kProxyAutoDetect));
1052 1061
1053 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) { 1062 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) {
1054 std::string proxy_bypass = 1063 std::string proxy_bypass =
1055 pref_service->GetString(prefs::kProxyBypassList); 1064 pref_service->GetString(prefs::kProxyBypassList);
1056 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass); 1065 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass);
1057 } 1066 }
1058 1067
1059 return proxy_config; 1068 return proxy_config;
1060 } 1069 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/proxy_config_service_impl_unittest.cc ('k') | chrome/browser/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698