| 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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 DISALLOW_COPY_AND_ASSIGN(ContainerURLRequestContext); | 185 DISALLOW_COPY_AND_ASSIGN(ContainerURLRequestContext); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 } // namespace | 188 } // namespace |
| 189 | 189 |
| 190 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() | 190 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() |
| 191 : type(IN_MEMORY), | 191 : type(IN_MEMORY), |
| 192 max_size(0) {} | 192 max_size(0) {} |
| 193 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} | 193 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} |
| 194 | 194 |
| 195 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams() | |
| 196 : ignore_certificate_errors(false), | |
| 197 testing_fixed_http_port(0), | |
| 198 testing_fixed_https_port(0), | |
| 199 enable_http2(true), | |
| 200 enable_quic(false), | |
| 201 quic_max_server_configs_stored_in_properties(0), | |
| 202 quic_close_sessions_on_ip_change(false), | |
| 203 quic_idle_connection_timeout_seconds(kIdleConnectionTimeoutSeconds), | |
| 204 quic_migrate_sessions_on_network_change(false), | |
| 205 quic_migrate_sessions_early(false), | |
| 206 quic_disable_bidirectional_streams(false), | |
| 207 quic_race_cert_verification(false) {} | |
| 208 | |
| 209 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() | |
| 210 {} | |
| 211 | |
| 212 void URLRequestContextBuilder::HttpNetworkSessionParams::ConfigureSessionParams( | |
| 213 HttpNetworkSession::Params* network_session_params) const { | |
| 214 network_session_params->host_mapping_rules = host_mapping_rules; | |
| 215 network_session_params->ignore_certificate_errors = ignore_certificate_errors; | |
| 216 network_session_params->testing_fixed_http_port = testing_fixed_http_port; | |
| 217 network_session_params->testing_fixed_https_port = testing_fixed_https_port; | |
| 218 | |
| 219 network_session_params->enable_http2 = enable_http2; | |
| 220 | |
| 221 network_session_params->enable_quic = enable_quic; | |
| 222 network_session_params->quic_user_agent_id = quic_user_agent_id; | |
| 223 network_session_params->quic_max_server_configs_stored_in_properties = | |
| 224 quic_max_server_configs_stored_in_properties; | |
| 225 network_session_params->quic_connection_options = quic_connection_options; | |
| 226 network_session_params->quic_close_sessions_on_ip_change = | |
| 227 quic_close_sessions_on_ip_change; | |
| 228 network_session_params->quic_idle_connection_timeout_seconds = | |
| 229 quic_idle_connection_timeout_seconds; | |
| 230 network_session_params->quic_migrate_sessions_on_network_change = | |
| 231 quic_migrate_sessions_on_network_change; | |
| 232 network_session_params->quic_migrate_sessions_early = | |
| 233 quic_migrate_sessions_early; | |
| 234 network_session_params->quic_disable_bidirectional_streams = | |
| 235 quic_disable_bidirectional_streams; | |
| 236 network_session_params->quic_race_cert_verification = | |
| 237 quic_race_cert_verification; | |
| 238 } | |
| 239 | |
| 240 URLRequestContextBuilder::URLRequestContextBuilder() | 195 URLRequestContextBuilder::URLRequestContextBuilder() |
| 241 : name_(nullptr), | 196 : name_(nullptr), |
| 242 enable_brotli_(false), | 197 enable_brotli_(false), |
| 243 network_quality_estimator_(nullptr), | 198 network_quality_estimator_(nullptr), |
| 244 data_enabled_(false), | 199 data_enabled_(false), |
| 245 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 200 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
| 246 file_enabled_(false), | 201 file_enabled_(false), |
| 247 #endif | 202 #endif |
| 248 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 203 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
| 249 ftp_enabled_(false), | 204 ftp_enabled_(false), |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 #endif // !defined(OS_LINUX) && !defined(OS_ANDROID) | 405 #endif // !defined(OS_LINUX) && !defined(OS_ANDROID) |
| 451 proxy_service_ = | 406 proxy_service_ = |
| 452 CreateProxyService(std::move(proxy_config_service_), context.get(), | 407 CreateProxyService(std::move(proxy_config_service_), context.get(), |
| 453 context->host_resolver(), | 408 context->host_resolver(), |
| 454 context->network_delegate(), context->net_log()); | 409 context->network_delegate(), context->net_log()); |
| 455 } | 410 } |
| 456 storage->set_proxy_service(std::move(proxy_service_)); | 411 storage->set_proxy_service(std::move(proxy_service_)); |
| 457 | 412 |
| 458 HttpNetworkSession::Context network_session_context; | 413 HttpNetworkSession::Context network_session_context; |
| 459 SetHttpNetworkSessionComponents(context.get(), &network_session_context); | 414 SetHttpNetworkSessionComponents(context.get(), &network_session_context); |
| 460 HttpNetworkSession::Params network_session_params; | |
| 461 http_network_session_params_.ConfigureSessionParams(&network_session_params); | |
| 462 | 415 |
| 463 if (proxy_delegate_) { | 416 if (proxy_delegate_) { |
| 464 network_session_context.proxy_delegate = proxy_delegate_.get(); | 417 network_session_context.proxy_delegate = proxy_delegate_.get(); |
| 465 storage->set_proxy_delegate(std::move(proxy_delegate_)); | 418 storage->set_proxy_delegate(std::move(proxy_delegate_)); |
| 466 } | 419 } |
| 467 if (socket_performance_watcher_factory_) { | 420 if (socket_performance_watcher_factory_) { |
| 468 network_session_context.socket_performance_watcher_factory = | 421 network_session_context.socket_performance_watcher_factory = |
| 469 socket_performance_watcher_factory_; | 422 socket_performance_watcher_factory_; |
| 470 } | 423 } |
| 471 | 424 |
| 472 storage->set_http_network_session(base::MakeUnique<HttpNetworkSession>( | 425 storage->set_http_network_session(base::MakeUnique<HttpNetworkSession>( |
| 473 network_session_params, network_session_context)); | 426 http_network_session_params_, network_session_context)); |
| 474 | 427 |
| 475 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; | 428 std::unique_ptr<HttpTransactionFactory> http_transaction_factory; |
| 476 if (http_cache_enabled_) { | 429 if (http_cache_enabled_) { |
| 477 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; | 430 std::unique_ptr<HttpCache::BackendFactory> http_cache_backend; |
| 478 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { | 431 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { |
| 479 BackendType backend_type = | 432 BackendType backend_type = |
| 480 http_cache_params_.type == HttpCacheParams::DISK | 433 http_cache_params_.type == HttpCacheParams::DISK |
| 481 ? CACHE_BACKEND_DEFAULT | 434 ? CACHE_BACKEND_DEFAULT |
| 482 : CACHE_BACKEND_SIMPLE; | 435 : CACHE_BACKEND_SIMPLE; |
| 483 http_cache_backend.reset(new HttpCache::DefaultBackend( | 436 http_cache_backend.reset(new HttpCache::DefaultBackend( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 std::unique_ptr<ProxyConfigService> proxy_config_service, | 498 std::unique_ptr<ProxyConfigService> proxy_config_service, |
| 546 URLRequestContext* url_request_context, | 499 URLRequestContext* url_request_context, |
| 547 HostResolver* host_resolver, | 500 HostResolver* host_resolver, |
| 548 NetworkDelegate* network_delegate, | 501 NetworkDelegate* network_delegate, |
| 549 NetLog* net_log) { | 502 NetLog* net_log) { |
| 550 return ProxyService::CreateUsingSystemProxyResolver( | 503 return ProxyService::CreateUsingSystemProxyResolver( |
| 551 std::move(proxy_config_service), net_log); | 504 std::move(proxy_config_service), net_log); |
| 552 } | 505 } |
| 553 | 506 |
| 554 } // namespace net | 507 } // namespace net |
| OLD | NEW |