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

Side by Side Diff: chromecast/browser/url_request_context_factory.cc

Issue 2067843003: Require a CTVerifier and CTPolicyEnforcer for TLS/QUIC sockets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixup Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/browser/url_request_context_factory.h" 5 #include "chromecast/browser/url_request_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "chromecast/base/chromecast_switches.h" 14 #include "chromecast/base/chromecast_switches.h"
15 #include "chromecast/browser/cast_http_user_agent_settings.h" 15 #include "chromecast/browser/cast_http_user_agent_settings.h"
16 #include "chromecast/browser/cast_network_delegate.h" 16 #include "chromecast/browser/cast_network_delegate.h"
17 #include "components/network_session_configurator/switches.h" 17 #include "components/network_session_configurator/switches.h"
18 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/cookie_store_factory.h" 20 #include "content/public/browser/cookie_store_factory.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "content/public/common/url_constants.h" 22 #include "content/public/common/url_constants.h"
23 #include "net/cert/cert_verifier.h" 23 #include "net/cert/cert_verifier.h"
24 #include "net/cert/ct_policy_enforcer.h"
25 #include "net/cert/multi_log_ct_verifier.h"
24 #include "net/cert_net/nss_ocsp.h" 26 #include "net/cert_net/nss_ocsp.h"
25 #include "net/cookies/cookie_store.h" 27 #include "net/cookies/cookie_store.h"
26 #include "net/dns/host_resolver.h" 28 #include "net/dns/host_resolver.h"
27 #include "net/http/http_auth_handler_factory.h" 29 #include "net/http/http_auth_handler_factory.h"
28 #include "net/http/http_network_layer.h" 30 #include "net/http/http_network_layer.h"
29 #include "net/http/http_server_properties_impl.h" 31 #include "net/http/http_server_properties_impl.h"
30 #include "net/http/http_stream_factory.h" 32 #include "net/http/http_stream_factory.h"
31 #include "net/proxy/proxy_service.h" 33 #include "net/proxy/proxy_service.h"
32 #include "net/ssl/channel_id_service.h" 34 #include "net/ssl/channel_id_service.h"
33 #include "net/ssl/default_channel_id_store.h" 35 #include "net/ssl/default_channel_id_store.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 media_getter_ = new URLRequestContextGetter(this, true); 196 media_getter_ = new URLRequestContextGetter(this, true);
195 } 197 }
196 return media_getter_.get(); 198 return media_getter_.get();
197 } 199 }
198 200
199 void URLRequestContextFactory::InitializeSystemContextDependencies() { 201 void URLRequestContextFactory::InitializeSystemContextDependencies() {
200 if (system_dependencies_initialized_) 202 if (system_dependencies_initialized_)
201 return; 203 return;
202 204
203 host_resolver_ = net::HostResolver::CreateDefaultResolver(NULL); 205 host_resolver_ = net::HostResolver::CreateDefaultResolver(NULL);
206 cert_verifier_ = net::CertVerifier::CreateDefault();
207 ssl_config_service_ = new net::SSLConfigServiceDefaults;
208 transport_security_state_.reset(new net::TransportSecurityState());
209 cert_transparency_verifier_.reset(new net::MultiLogCTVerifier());
210 ct_policy_enforcer_.reset(new net::CTPolicyEnforcer());
204 211
205 cert_verifier_ = net::CertVerifier::CreateDefault();
206
207 ssl_config_service_ = new net::SSLConfigServiceDefaults;
208
209 transport_security_state_.reset(new net::TransportSecurityState());
210 http_auth_handler_factory_ = 212 http_auth_handler_factory_ =
211 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get()); 213 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get());
212 214
213 // TODO(lcwu): http://crbug.com/392352. For performance reasons, 215 // TODO(lcwu): http://crbug.com/392352. For performance reasons,
214 // a persistent (on-disk) HttpServerProperties might be desirable 216 // a persistent (on-disk) HttpServerProperties might be desirable
215 // in the future. 217 // in the future.
216 http_server_properties_.reset(new net::HttpServerPropertiesImpl); 218 http_server_properties_.reset(new net::HttpServerPropertiesImpl);
217 219
218 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( 220 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver(
219 std::move(proxy_config_service_), 0, NULL); 221 std::move(proxy_config_service_), 0, NULL);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 284 }
283 285
284 void URLRequestContextFactory::PopulateNetworkSessionParams( 286 void URLRequestContextFactory::PopulateNetworkSessionParams(
285 bool ignore_certificate_errors, 287 bool ignore_certificate_errors,
286 net::HttpNetworkSession::Params* params) { 288 net::HttpNetworkSession::Params* params) {
287 params->host_resolver = host_resolver_.get(); 289 params->host_resolver = host_resolver_.get();
288 params->cert_verifier = cert_verifier_.get(); 290 params->cert_verifier = cert_verifier_.get();
289 params->channel_id_service = channel_id_service_.get(); 291 params->channel_id_service = channel_id_service_.get();
290 params->ssl_config_service = ssl_config_service_.get(); 292 params->ssl_config_service = ssl_config_service_.get();
291 params->transport_security_state = transport_security_state_.get(); 293 params->transport_security_state = transport_security_state_.get();
294 params->cert_transparency_verifier = cert_transparency_verifier_.get();
295 params->ct_policy_enforcer = ct_policy_enforcer_.get();
292 params->http_auth_handler_factory = http_auth_handler_factory_.get(); 296 params->http_auth_handler_factory = http_auth_handler_factory_.get();
293 params->http_server_properties = http_server_properties_.get(); 297 params->http_server_properties = http_server_properties_.get();
294 params->ignore_certificate_errors = ignore_certificate_errors; 298 params->ignore_certificate_errors = ignore_certificate_errors;
295 params->proxy_service = proxy_service_.get(); 299 params->proxy_service = proxy_service_.get();
296 } 300 }
297 301
298 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { 302 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() {
299 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 303 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
300 InitializeSystemContextDependencies(); 304 InitializeSystemContextDependencies();
301 net::HttpNetworkSession::Params system_params; 305 net::HttpNetworkSession::Params system_params;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 401
398 void URLRequestContextFactory::InitializeNetworkDelegates() { 402 void URLRequestContextFactory::InitializeNetworkDelegates() {
399 app_network_delegate_->Initialize(false); 403 app_network_delegate_->Initialize(false);
400 LOG(INFO) << "Initialized app network delegate."; 404 LOG(INFO) << "Initialized app network delegate.";
401 system_network_delegate_->Initialize(false); 405 system_network_delegate_->Initialize(false);
402 LOG(INFO) << "Initialized system network delegate."; 406 LOG(INFO) << "Initialized system network delegate.";
403 } 407 }
404 408
405 } // namespace shell 409 } // namespace shell
406 } // namespace chromecast 410 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698