OLD | NEW |
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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 : type(IN_MEMORY), | 186 : type(IN_MEMORY), |
187 max_size(0) {} | 187 max_size(0) {} |
188 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} | 188 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} |
189 | 189 |
190 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams() | 190 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams() |
191 : ignore_certificate_errors(false), | 191 : ignore_certificate_errors(false), |
192 host_mapping_rules(NULL), | 192 host_mapping_rules(NULL), |
193 testing_fixed_http_port(0), | 193 testing_fixed_http_port(0), |
194 testing_fixed_https_port(0), | 194 testing_fixed_https_port(0), |
195 next_protos(NextProtosDefaults()), | 195 next_protos(NextProtosDefaults()), |
196 use_alternate_protocols(true) { | 196 use_alternate_protocols(true), |
| 197 enable_quic(false) { |
197 } | 198 } |
198 | 199 |
199 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() | 200 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() |
200 {} | 201 {} |
201 | 202 |
202 URLRequestContextBuilder::SchemeFactory::SchemeFactory( | 203 URLRequestContextBuilder::SchemeFactory::SchemeFactory( |
203 const std::string& auth_scheme, | 204 const std::string& auth_scheme, |
204 net::HttpAuthHandlerFactory* auth_handler_factory) | 205 net::HttpAuthHandlerFactory* auth_handler_factory) |
205 : scheme(auth_scheme), factory(auth_handler_factory) { | 206 : scheme(auth_scheme), factory(auth_handler_factory) { |
206 } | 207 } |
(...skipping 22 matching lines...) Expand all Loading... |
229 | 230 |
230 void URLRequestContextBuilder::DisableHttpCache() { | 231 void URLRequestContextBuilder::DisableHttpCache() { |
231 http_cache_enabled_ = false; | 232 http_cache_enabled_ = false; |
232 http_cache_params_ = HttpCacheParams(); | 233 http_cache_params_ = HttpCacheParams(); |
233 } | 234 } |
234 | 235 |
235 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, | 236 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, |
236 bool quic_enabled) { | 237 bool quic_enabled) { |
237 http_network_session_params_.next_protos = | 238 http_network_session_params_.next_protos = |
238 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); | 239 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); |
| 240 http_network_session_params_.enable_quic = quic_enabled; |
239 } | 241 } |
240 | 242 |
241 URLRequestContext* URLRequestContextBuilder::Build() { | 243 URLRequestContext* URLRequestContextBuilder::Build() { |
242 BasicURLRequestContext* context = new BasicURLRequestContext; | 244 BasicURLRequestContext* context = new BasicURLRequestContext; |
243 URLRequestContextStorage* storage = context->storage(); | 245 URLRequestContextStorage* storage = context->storage(); |
244 | 246 |
245 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings( | 247 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings( |
246 accept_language_, user_agent_)); | 248 accept_language_, user_agent_)); |
247 | 249 |
248 if (!network_delegate_) | 250 if (!network_delegate_) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 http_network_session_params_.host_mapping_rules; | 347 http_network_session_params_.host_mapping_rules; |
346 network_session_params.testing_fixed_http_port = | 348 network_session_params.testing_fixed_http_port = |
347 http_network_session_params_.testing_fixed_http_port; | 349 http_network_session_params_.testing_fixed_http_port; |
348 network_session_params.testing_fixed_https_port = | 350 network_session_params.testing_fixed_https_port = |
349 http_network_session_params_.testing_fixed_https_port; | 351 http_network_session_params_.testing_fixed_https_port; |
350 network_session_params.use_alternate_protocols = | 352 network_session_params.use_alternate_protocols = |
351 http_network_session_params_.use_alternate_protocols; | 353 http_network_session_params_.use_alternate_protocols; |
352 network_session_params.trusted_spdy_proxy = | 354 network_session_params.trusted_spdy_proxy = |
353 http_network_session_params_.trusted_spdy_proxy; | 355 http_network_session_params_.trusted_spdy_proxy; |
354 network_session_params.next_protos = http_network_session_params_.next_protos; | 356 network_session_params.next_protos = http_network_session_params_.next_protos; |
| 357 network_session_params.enable_quic = http_network_session_params_.enable_quic; |
355 | 358 |
356 HttpTransactionFactory* http_transaction_factory = NULL; | 359 HttpTransactionFactory* http_transaction_factory = NULL; |
357 if (http_cache_enabled_) { | 360 if (http_cache_enabled_) { |
358 network_session_params.channel_id_service = | 361 network_session_params.channel_id_service = |
359 context->channel_id_service(); | 362 context->channel_id_service(); |
360 HttpCache::BackendFactory* http_cache_backend = NULL; | 363 HttpCache::BackendFactory* http_cache_backend = NULL; |
361 if (http_cache_params_.type == HttpCacheParams::DISK) { | 364 if (http_cache_params_.type == HttpCacheParams::DISK) { |
362 http_cache_backend = new HttpCache::DefaultBackend( | 365 http_cache_backend = new HttpCache::DefaultBackend( |
363 DISK_CACHE, | 366 DISK_CACHE, |
364 net::CACHE_BACKEND_DEFAULT, | 367 net::CACHE_BACKEND_DEFAULT, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 #endif // !defined(DISABLE_FTP_SUPPORT) | 405 #endif // !defined(DISABLE_FTP_SUPPORT) |
403 | 406 |
404 storage->set_job_factory(job_factory); | 407 storage->set_job_factory(job_factory); |
405 | 408 |
406 // TODO(willchan): Support sdch. | 409 // TODO(willchan): Support sdch. |
407 | 410 |
408 return context; | 411 return context; |
409 } | 412 } |
410 | 413 |
411 } // namespace net | 414 } // namespace net |
OLD | NEW |