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

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

Issue 5961005: Create a URLRequestContext for PAC fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove need for IOThread in unit_tests. Woot! Created 10 years 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) 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 15 matching lines...) Expand all
26 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/notification_service.h" 27 #include "chrome/common/notification_service.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "net/base/static_cookie_policy.h" 30 #include "net/base/static_cookie_policy.h"
31 #include "net/ftp/ftp_network_layer.h" 31 #include "net/ftp/ftp_network_layer.h"
32 #include "net/http/http_cache.h" 32 #include "net/http/http_cache.h"
33 #include "net/http/http_network_layer.h" 33 #include "net/http/http_network_layer.h"
34 #include "net/http/http_util.h" 34 #include "net/http/http_util.h"
35 #include "net/proxy/proxy_config_service_fixed.h" 35 #include "net/proxy/proxy_config_service_fixed.h"
36 #include "net/proxy/proxy_script_fetcher.h" 36 #include "net/proxy/proxy_script_fetcher_impl.h"
37 #include "net/proxy/proxy_service.h" 37 #include "net/proxy/proxy_service.h"
38 #include "net/url_request/url_request.h" 38 #include "net/url_request/url_request.h"
39 #include "webkit/glue/webkit_glue.h" 39 #include "webkit/glue/webkit_glue.h"
40 40
41 #if defined(USE_NSS) 41 #if defined(USE_NSS)
42 #include "net/ocsp/nss_ocsp.h" 42 #include "net/ocsp/nss_ocsp.h"
43 #endif 43 #endif
44 44
45 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
46 #include "chrome/browser/chromeos/proxy_config_service.h" 46 #include "chrome/browser/chromeos/proxy_config_service.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 return new PrefProxyConfigService(profile->GetProxyConfigTracker(), 89 return new PrefProxyConfigService(profile->GetProxyConfigTracker(),
90 base_service); 90 base_service);
91 } 91 }
92 92
93 // Create a proxy service according to the options on command line. 93 // Create a proxy service according to the options on command line.
94 net::ProxyService* CreateProxyService( 94 net::ProxyService* CreateProxyService(
95 net::NetLog* net_log, 95 net::NetLog* net_log,
96 URLRequestContext* context, 96 URLRequestContext* context,
97 net::ProxyConfigService* proxy_config_service, 97 net::ProxyConfigService* proxy_config_service,
98 const CommandLine& command_line, 98 const CommandLine& command_line) {
99 IOThread* io_thread) {
100 CheckCurrentlyOnIOThread(); 99 CheckCurrentlyOnIOThread();
101 100
102 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); 101 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver);
103 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { 102 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
104 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h 103 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h
105 // to understand why we have this limitation. 104 // to understand why we have this limitation.
106 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; 105 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
107 use_v8 = false; // Fallback to non-v8 implementation. 106 use_v8 = false; // Fallback to non-v8 implementation.
108 } 107 }
109 108
(...skipping 10 matching lines...) Expand all
120 num_pac_threads = static_cast<size_t>(n); 119 num_pac_threads = static_cast<size_t>(n);
121 } else { 120 } else {
122 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; 121 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s;
123 } 122 }
124 } 123 }
125 124
126 if (use_v8) { 125 if (use_v8) {
127 return net::ProxyService::CreateUsingV8ProxyResolver( 126 return net::ProxyService::CreateUsingV8ProxyResolver(
128 proxy_config_service, 127 proxy_config_service,
129 num_pac_threads, 128 num_pac_threads,
130 io_thread->CreateAndRegisterProxyScriptFetcher(context), 129 new net::ProxyScriptFetcherImpl(context),
131 context->host_resolver(), 130 context->host_resolver(),
132 net_log); 131 net_log);
133 } 132 }
134 133
135 return net::ProxyService::CreateUsingSystemProxyResolver( 134 return net::ProxyService::CreateUsingSystemProxyResolver(
136 proxy_config_service, 135 proxy_config_service,
137 num_pac_threads, 136 num_pac_threads,
138 net_log); 137 net_log);
139 } 138 }
140 139
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 io_thread_globals->http_auth_handler_factory.get()); 267 io_thread_globals->http_auth_handler_factory.get());
269 268
270 context->set_dns_cert_checker( 269 context->set_dns_cert_checker(
271 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), 270 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(),
272 context)); 271 context));
273 272
274 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 273 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
275 274
276 context->set_proxy_service( 275 context->set_proxy_service(
277 CreateProxyService(io_thread()->net_log(), 276 CreateProxyService(io_thread()->net_log(),
278 context, 277 io_thread_globals->proxy_request_context.get(),
279 proxy_config_service_.release(), 278 proxy_config_service_.release(),
280 command_line, 279 command_line));
281 io_thread()));
282 280
283 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( 281 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
284 net::DISK_CACHE, disk_cache_path_, cache_size_, 282 net::DISK_CACHE, disk_cache_path_, cache_size_,
285 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); 283 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
286 net::HttpCache* cache = 284 net::HttpCache* cache =
287 new net::HttpCache(context->host_resolver(), 285 new net::HttpCache(context->host_resolver(),
288 context->cert_verifier(), 286 context->cert_verifier(),
289 context->dnsrr_resolver(), 287 context->dnsrr_resolver(),
290 context->dns_cert_checker(), 288 context->dns_cert_checker(),
291 context->proxy_service(), 289 context->proxy_service(),
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 context->set_host_zoom_map(host_zoom_map_); 905 context->set_host_zoom_map(host_zoom_map_);
908 context->set_transport_security_state( 906 context->set_transport_security_state(
909 transport_security_state_); 907 transport_security_state_);
910 context->set_ssl_config_service(ssl_config_service_); 908 context->set_ssl_config_service(ssl_config_service_);
911 context->set_appcache_service(appcache_service_); 909 context->set_appcache_service(appcache_service_);
912 context->set_database_tracker(database_tracker_); 910 context->set_database_tracker(database_tracker_);
913 context->set_blob_storage_context(blob_storage_context_); 911 context->set_blob_storage_context(blob_storage_context_);
914 context->set_file_system_context(file_system_context_); 912 context->set_file_system_context(file_system_context_);
915 context->set_extension_info_map(extension_info_map_); 913 context->set_extension_info_map(extension_info_map_);
916 } 914 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698