Chromium Code Reviews| 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; | |
| 241 | |
| 242 // TODO(mef): Figure out why QUIC doesn't work without force. | |
| 243 if (quic_enabled) { | |
| 244 AlternateProtocolInfo pair(443, QUIC, 1); | |
| 245 HttpServerPropertiesImpl::ForceAlternateProtocol(pair); | |
|
Ryan Hamilton
2014/09/10 20:58:18
Please do not actually land this :>
mef
2014/09/12 19:44:33
Done. I mean undone.
| |
| 246 } | |
| 239 } | 247 } |
| 240 | 248 |
| 241 URLRequestContext* URLRequestContextBuilder::Build() { | 249 URLRequestContext* URLRequestContextBuilder::Build() { |
| 242 BasicURLRequestContext* context = new BasicURLRequestContext; | 250 BasicURLRequestContext* context = new BasicURLRequestContext; |
| 243 URLRequestContextStorage* storage = context->storage(); | 251 URLRequestContextStorage* storage = context->storage(); |
| 244 | 252 |
| 245 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings( | 253 storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings( |
| 246 accept_language_, user_agent_)); | 254 accept_language_, user_agent_)); |
| 247 | 255 |
| 248 if (!network_delegate_) | 256 if (!network_delegate_) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 http_network_session_params_.host_mapping_rules; | 353 http_network_session_params_.host_mapping_rules; |
| 346 network_session_params.testing_fixed_http_port = | 354 network_session_params.testing_fixed_http_port = |
| 347 http_network_session_params_.testing_fixed_http_port; | 355 http_network_session_params_.testing_fixed_http_port; |
| 348 network_session_params.testing_fixed_https_port = | 356 network_session_params.testing_fixed_https_port = |
| 349 http_network_session_params_.testing_fixed_https_port; | 357 http_network_session_params_.testing_fixed_https_port; |
| 350 network_session_params.use_alternate_protocols = | 358 network_session_params.use_alternate_protocols = |
| 351 http_network_session_params_.use_alternate_protocols; | 359 http_network_session_params_.use_alternate_protocols; |
| 352 network_session_params.trusted_spdy_proxy = | 360 network_session_params.trusted_spdy_proxy = |
| 353 http_network_session_params_.trusted_spdy_proxy; | 361 http_network_session_params_.trusted_spdy_proxy; |
| 354 network_session_params.next_protos = http_network_session_params_.next_protos; | 362 network_session_params.next_protos = http_network_session_params_.next_protos; |
| 363 network_session_params.enable_quic = http_network_session_params_.enable_quic; | |
| 355 | 364 |
| 356 HttpTransactionFactory* http_transaction_factory = NULL; | 365 HttpTransactionFactory* http_transaction_factory = NULL; |
| 357 if (http_cache_enabled_) { | 366 if (http_cache_enabled_) { |
| 358 network_session_params.channel_id_service = | 367 network_session_params.channel_id_service = |
| 359 context->channel_id_service(); | 368 context->channel_id_service(); |
| 360 HttpCache::BackendFactory* http_cache_backend = NULL; | 369 HttpCache::BackendFactory* http_cache_backend = NULL; |
| 361 if (http_cache_params_.type == HttpCacheParams::DISK) { | 370 if (http_cache_params_.type == HttpCacheParams::DISK) { |
| 362 http_cache_backend = new HttpCache::DefaultBackend( | 371 http_cache_backend = new HttpCache::DefaultBackend( |
| 363 DISK_CACHE, | 372 DISK_CACHE, |
| 364 net::CACHE_BACKEND_DEFAULT, | 373 net::CACHE_BACKEND_DEFAULT, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 #endif // !defined(DISABLE_FTP_SUPPORT) | 411 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 403 | 412 |
| 404 storage->set_job_factory(job_factory); | 413 storage->set_job_factory(job_factory); |
| 405 | 414 |
| 406 // TODO(willchan): Support sdch. | 415 // TODO(willchan): Support sdch. |
| 407 | 416 |
| 408 return context; | 417 return context; |
| 409 } | 418 } |
| 410 | 419 |
| 411 } // namespace net | 420 } // namespace net |
| OLD | NEW |