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

Side by Side Diff: net/url_request/url_request_context_builder.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
15 #include "net/base/cert_verifier.h" 15 #include "net/base/cert_verifier.h"
16 #include "net/base/host_resolver.h" 16 #include "net/base/host_resolver.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #include "net/base/network_delegate.h" 18 #include "net/base/network_delegate.h"
19 #include "net/base/ssl_config_service_defaults.h" 19 #include "net/base/ssl_config_service_defaults.h"
20 #include "net/base/transport_security_state.h" 20 #include "net/base/transport_security_state.h"
21 #include "net/cookies/cookie_monster.h" 21 #include "net/cookies/cookie_monster.h"
22 #include "net/ftp/ftp_network_layer.h"
23 #include "net/http/http_auth_handler_factory.h" 22 #include "net/http/http_auth_handler_factory.h"
24 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
25 #include "net/http/http_network_layer.h" 24 #include "net/http/http_network_layer.h"
26 #include "net/http/http_network_session.h" 25 #include "net/http/http_network_session.h"
27 #include "net/http/http_server_properties_impl.h" 26 #include "net/http/http_server_properties_impl.h"
28 #include "net/proxy/proxy_service.h" 27 #include "net/proxy/proxy_service.h"
29 #include "net/url_request/static_http_user_agent_settings.h" 28 #include "net/url_request/static_http_user_agent_settings.h"
30 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
31 #include "net/url_request/url_request_context_storage.h" 30 #include "net/url_request/url_request_context_storage.h"
32 31
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 host_mapping_rules(NULL), 172 host_mapping_rules(NULL),
174 http_pipelining_enabled(false), 173 http_pipelining_enabled(false),
175 testing_fixed_http_port(0), 174 testing_fixed_http_port(0),
176 testing_fixed_https_port(0), 175 testing_fixed_https_port(0),
177 trusted_spdy_proxy() {} 176 trusted_spdy_proxy() {}
178 177
179 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() 178 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams()
180 {} 179 {}
181 180
182 URLRequestContextBuilder::URLRequestContextBuilder() 181 URLRequestContextBuilder::URLRequestContextBuilder()
183 : ftp_enabled_(false), 182 : http_cache_enabled_(true) {}
184 http_cache_enabled_(true) {}
185 URLRequestContextBuilder::~URLRequestContextBuilder() {} 183 URLRequestContextBuilder::~URLRequestContextBuilder() {}
186 184
187 #if defined(OS_LINUX) || defined(OS_ANDROID) 185 #if defined(OS_LINUX) || defined(OS_ANDROID)
188 void URLRequestContextBuilder::set_proxy_config_service( 186 void URLRequestContextBuilder::set_proxy_config_service(
189 ProxyConfigService* proxy_config_service) { 187 ProxyConfigService* proxy_config_service) {
190 proxy_config_service_.reset(proxy_config_service); 188 proxy_config_service_.reset(proxy_config_service);
191 } 189 }
192 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 190 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
193 191
194 URLRequestContext* URLRequestContextBuilder::Build() { 192 URLRequestContext* URLRequestContextBuilder::Build() {
195 BasicURLRequestContext* context = new BasicURLRequestContext; 193 BasicURLRequestContext* context = new BasicURLRequestContext;
196 URLRequestContextStorage* storage = context->storage(); 194 URLRequestContextStorage* storage = context->storage();
197 195
198 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings( 196 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings(
199 accept_language_, accept_charset_, user_agent_)); 197 accept_language_, accept_charset_, user_agent_));
200 198
201 if (!network_delegate_) 199 if (!network_delegate_)
202 network_delegate_.reset(new BasicNetworkDelegate); 200 network_delegate_.reset(new BasicNetworkDelegate);
203 storage->set_network_delegate(network_delegate_.release()); 201 storage->set_network_delegate(network_delegate_.release());
204 202
205 storage->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); 203 storage->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL));
206 204
207 if (ftp_enabled_) {
208 storage->set_ftp_transaction_factory(
209 new FtpNetworkLayer(context->host_resolver()));
210 }
211
212 context->StartFileThread(); 205 context->StartFileThread();
213 206
214 // TODO(willchan): Switch to using this code when 207 // TODO(willchan): Switch to using this code when
215 // ProxyService::CreateSystemProxyConfigService()'s signature doesn't suck. 208 // ProxyService::CreateSystemProxyConfigService()'s signature doesn't suck.
216 #if defined(OS_LINUX) || defined(OS_ANDROID) 209 #if defined(OS_LINUX) || defined(OS_ANDROID)
217 ProxyConfigService* proxy_config_service = proxy_config_service_.release(); 210 ProxyConfigService* proxy_config_service = proxy_config_service_.release();
218 #else 211 #else
219 ProxyConfigService* proxy_config_service = 212 ProxyConfigService* proxy_config_service =
220 ProxyService::CreateSystemProxyConfigService( 213 ProxyService::CreateSystemProxyConfigService(
221 base::ThreadTaskRunnerHandle::Get(), 214 base::ThreadTaskRunnerHandle::Get(),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 http_transaction_factory = new HttpNetworkLayer(network_session); 282 http_transaction_factory = new HttpNetworkLayer(network_session);
290 } 283 }
291 storage->set_http_transaction_factory(http_transaction_factory); 284 storage->set_http_transaction_factory(http_transaction_factory);
292 285
293 // TODO(willchan): Support sdch. 286 // TODO(willchan): Support sdch.
294 287
295 return context; 288 return context;
296 } 289 }
297 290
298 } // namespace net 291 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698