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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "net/base/cache_type.h" | 19 #include "net/base/cache_type.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/network_delegate_impl.h" | 21 #include "net/base/network_delegate_impl.h" |
| 22 #include "net/base/sdch_manager.h" | 22 #include "net/base/sdch_manager.h" |
| 23 #include "net/cert/cert_verifier.h" | 23 #include "net/cert/cert_verifier.h" |
| 24 #include "net/cert/ct_known_logs.h" | |
| 25 #include "net/cert/ct_log_verifier.h" | |
| 24 #include "net/cert/ct_policy_enforcer.h" | 26 #include "net/cert/ct_policy_enforcer.h" |
| 27 #include "net/cert/ct_verifier.h" | |
| 25 #include "net/cert/multi_log_ct_verifier.h" | 28 #include "net/cert/multi_log_ct_verifier.h" |
| 26 #include "net/cookies/cookie_monster.h" | 29 #include "net/cookies/cookie_monster.h" |
| 27 #include "net/dns/host_resolver.h" | 30 #include "net/dns/host_resolver.h" |
| 28 #include "net/http/http_auth_handler_factory.h" | 31 #include "net/http/http_auth_handler_factory.h" |
| 29 #include "net/http/http_cache.h" | 32 #include "net/http/http_cache.h" |
| 30 #include "net/http/http_network_layer.h" | 33 #include "net/http/http_network_layer.h" |
| 31 #include "net/http/http_server_properties_impl.h" | 34 #include "net/http/http_server_properties_impl.h" |
| 32 #include "net/http/http_server_properties_manager.h" | 35 #include "net/http/http_server_properties_manager.h" |
| 33 #include "net/http/transport_security_persister.h" | 36 #include "net/http/transport_security_persister.h" |
| 34 #include "net/http/transport_security_state.h" | 37 #include "net/http/transport_security_state.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 http_cache_enabled_ = false; | 245 http_cache_enabled_ = false; |
| 243 http_cache_params_ = HttpCacheParams(); | 246 http_cache_params_ = HttpCacheParams(); |
| 244 } | 247 } |
| 245 | 248 |
| 246 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, | 249 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, |
| 247 bool quic_enabled) { | 250 bool quic_enabled) { |
| 248 http_network_session_params_.enable_http2 = spdy_enabled; | 251 http_network_session_params_.enable_http2 = spdy_enabled; |
| 249 http_network_session_params_.enable_quic = quic_enabled; | 252 http_network_session_params_.enable_quic = quic_enabled; |
| 250 } | 253 } |
| 251 | 254 |
| 255 void URLRequestContextBuilder::set_ct_verifier( | |
|
eroman
2016/07/19 22:55:40
Why the naming difference from SetCertVerifier() /
Ryan Sleevi
2016/07/19 23:04:53
It's consistent with the dominant style, and SetCe
| |
| 256 std::unique_ptr<CTVerifier> ct_verifier) { | |
| 257 ct_verifier_ = std::move(ct_verifier); | |
| 258 } | |
| 259 | |
| 252 void URLRequestContextBuilder::SetCertVerifier( | 260 void URLRequestContextBuilder::SetCertVerifier( |
| 253 std::unique_ptr<CertVerifier> cert_verifier) { | 261 std::unique_ptr<CertVerifier> cert_verifier) { |
| 254 cert_verifier_ = std::move(cert_verifier); | 262 cert_verifier_ = std::move(cert_verifier); |
| 255 } | 263 } |
| 256 | 264 |
| 257 void URLRequestContextBuilder::SetInterceptors( | 265 void URLRequestContextBuilder::SetInterceptors( |
| 258 std::vector<std::unique_ptr<URLRequestInterceptor>> | 266 std::vector<std::unique_ptr<URLRequestInterceptor>> |
| 259 url_request_interceptors) { | 267 url_request_interceptors) { |
| 260 url_request_interceptors_ = std::move(url_request_interceptors); | 268 url_request_interceptors_ = std::move(url_request_interceptors); |
| 261 } | 269 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 storage->set_http_server_properties( | 388 storage->set_http_server_properties( |
| 381 std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); | 389 std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); |
| 382 } | 390 } |
| 383 | 391 |
| 384 if (cert_verifier_) { | 392 if (cert_verifier_) { |
| 385 storage->set_cert_verifier(std::move(cert_verifier_)); | 393 storage->set_cert_verifier(std::move(cert_verifier_)); |
| 386 } else { | 394 } else { |
| 387 storage->set_cert_verifier(CertVerifier::CreateDefault()); | 395 storage->set_cert_verifier(CertVerifier::CreateDefault()); |
| 388 } | 396 } |
| 389 | 397 |
| 390 storage->set_cert_transparency_verifier( | 398 if (ct_verifier_) { |
| 391 base::MakeUnique<MultiLogCTVerifier>()); | 399 storage->set_cert_transparency_verifier(std::move(ct_verifier_)); |
| 400 } else { | |
| 401 std::unique_ptr<MultiLogCTVerifier> ct_verifier = | |
| 402 base::MakeUnique<MultiLogCTVerifier>(); | |
| 403 ct_verifier->AddLogs(ct::CreateLogVerifiersForKnownLogs()); | |
| 404 storage->set_cert_transparency_verifier(std::move(ct_verifier)); | |
| 405 } | |
| 392 storage->set_ct_policy_enforcer(base::MakeUnique<CTPolicyEnforcer>()); | 406 storage->set_ct_policy_enforcer(base::MakeUnique<CTPolicyEnforcer>()); |
| 393 | 407 |
| 394 if (throttling_enabled_) { | 408 if (throttling_enabled_) { |
| 395 storage->set_throttler_manager( | 409 storage->set_throttler_manager( |
| 396 base::WrapUnique(new URLRequestThrottlerManager())); | 410 base::WrapUnique(new URLRequestThrottlerManager())); |
| 397 } | 411 } |
| 398 | 412 |
| 399 if (backoff_enabled_) { | 413 if (backoff_enabled_) { |
| 400 storage->set_backoff_manager( | 414 storage->set_backoff_manager( |
| 401 base::WrapUnique(new URLRequestBackoffManager())); | 415 base::WrapUnique(new URLRequestBackoffManager())); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 } | 533 } |
| 520 url_request_interceptors_.clear(); | 534 url_request_interceptors_.clear(); |
| 521 } | 535 } |
| 522 storage->set_job_factory(std::move(top_job_factory)); | 536 storage->set_job_factory(std::move(top_job_factory)); |
| 523 // TODO(willchan): Support sdch. | 537 // TODO(willchan): Support sdch. |
| 524 | 538 |
| 525 return std::move(context); | 539 return std::move(context); |
| 526 } | 540 } |
| 527 | 541 |
| 528 } // namespace net | 542 } // namespace net |
| OLD | NEW |