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

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

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Response to comments Created 3 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"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 net::HttpTransactionFactory* transaction_factory) { 313 net::HttpTransactionFactory* transaction_factory) {
314 if (media_dependencies_initialized_) 314 if (media_dependencies_initialized_)
315 return; 315 return;
316 316
317 media_transaction_factory_.reset(transaction_factory); 317 media_transaction_factory_.reset(transaction_factory);
318 media_dependencies_initialized_ = true; 318 media_dependencies_initialized_ = true;
319 } 319 }
320 320
321 void URLRequestContextFactory::PopulateNetworkSessionParams( 321 void URLRequestContextFactory::PopulateNetworkSessionParams(
322 bool ignore_certificate_errors, 322 bool ignore_certificate_errors,
323 net::HttpNetworkSession::Params* params) { 323 net::HttpNetworkSession::Params* session_params,
324 net::HttpNetworkSession::Context* session_context) {
324 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 325 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
325 params->host_resolver = host_resolver_.get(); 326 session_context->host_resolver = host_resolver_.get();
326 params->cert_verifier = cert_verifier_.get(); 327 session_context->cert_verifier = cert_verifier_.get();
327 params->channel_id_service = channel_id_service_.get(); 328 session_context->channel_id_service = channel_id_service_.get();
328 params->ssl_config_service = ssl_config_service_.get(); 329 session_context->ssl_config_service = ssl_config_service_.get();
329 params->transport_security_state = transport_security_state_.get(); 330 session_context->transport_security_state = transport_security_state_.get();
330 params->cert_transparency_verifier = cert_transparency_verifier_.get(); 331 session_context->cert_transparency_verifier =
331 params->ct_policy_enforcer = ct_policy_enforcer_.get(); 332 cert_transparency_verifier_.get();
332 params->http_auth_handler_factory = http_auth_handler_factory_.get(); 333 session_context->ct_policy_enforcer = ct_policy_enforcer_.get();
333 params->http_server_properties = http_server_properties_.get(); 334 session_context->http_auth_handler_factory = http_auth_handler_factory_.get();
334 params->ignore_certificate_errors = ignore_certificate_errors; 335 session_context->http_server_properties = http_server_properties_.get();
335 params->proxy_service = proxy_service_.get(); 336 session_context->proxy_service = proxy_service_.get();
336 337
338 session_params->ignore_certificate_errors = ignore_certificate_errors;
337 LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " << enable_quic_; 339 LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " << enable_quic_;
338 params->enable_quic = enable_quic_; 340 session_params->enable_quic = enable_quic_;
339 } 341 }
340 342
341 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { 343 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() {
342 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 344 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
343 InitializeSystemContextDependencies(); 345 InitializeSystemContextDependencies();
344 net::HttpNetworkSession::Params system_params; 346 net::HttpNetworkSession::Params session_params;
345 PopulateNetworkSessionParams(IgnoreCertificateErrors(), &system_params); 347 net::HttpNetworkSession::Context session_context;
348 PopulateNetworkSessionParams(IgnoreCertificateErrors(), &session_params,
349 &session_context);
346 system_transaction_factory_.reset(new net::HttpNetworkLayer( 350 system_transaction_factory_.reset(new net::HttpNetworkLayer(
347 new net::HttpNetworkSession(system_params))); 351 new net::HttpNetworkSession(session_params, session_context)));
348 system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); 352 system_job_factory_.reset(new net::URLRequestJobFactoryImpl());
349 system_cookie_store_ = 353 system_cookie_store_ =
350 content::CreateCookieStore(content::CookieStoreConfig()); 354 content::CreateCookieStore(content::CookieStoreConfig());
351 355
352 net::URLRequestContext* system_context = new net::URLRequestContext(); 356 net::URLRequestContext* system_context = new net::URLRequestContext();
353 system_context->set_host_resolver(host_resolver_.get()); 357 system_context->set_host_resolver(host_resolver_.get());
354 system_context->set_channel_id_service(channel_id_service_.get()); 358 system_context->set_channel_id_service(channel_id_service_.get());
355 system_context->set_cert_verifier(cert_verifier_.get()); 359 system_context->set_cert_verifier(cert_verifier_.get());
356 system_context->set_proxy_service(proxy_service_.get()); 360 system_context->set_proxy_service(proxy_service_.get());
357 system_context->set_ssl_config_service(ssl_config_service_.get()); 361 system_context->set_ssl_config_service(ssl_config_service_.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return media_context; 395 return media_context;
392 } 396 }
393 397
394 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( 398 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext(
395 const base::FilePath& cookie_path, 399 const base::FilePath& cookie_path,
396 content::ProtocolHandlerMap* protocol_handlers, 400 content::ProtocolHandlerMap* protocol_handlers,
397 content::URLRequestInterceptorScopedVector request_interceptors) { 401 content::URLRequestInterceptorScopedVector request_interceptors) {
398 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 402 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
399 InitializeSystemContextDependencies(); 403 InitializeSystemContextDependencies();
400 404
401 net::HttpNetworkSession::Params network_session_params; 405 net::HttpNetworkSession::Params session_params;
402 PopulateNetworkSessionParams(IgnoreCertificateErrors(), 406 net::HttpNetworkSession::Context session_context;
403 &network_session_params); 407 PopulateNetworkSessionParams(IgnoreCertificateErrors(), &session_params,
408 &session_context);
404 InitializeMainContextDependencies( 409 InitializeMainContextDependencies(
405 new net::HttpNetworkLayer( 410 new net::HttpNetworkLayer(
406 new net::HttpNetworkSession(network_session_params)), 411 new net::HttpNetworkSession(session_params, session_context)),
407 protocol_handlers, std::move(request_interceptors)); 412 protocol_handlers, std::move(request_interceptors));
408 413
409 content::CookieStoreConfig cookie_config( 414 content::CookieStoreConfig cookie_config(
410 cookie_path, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, 415 cookie_path, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES,
411 nullptr, nullptr); 416 nullptr, nullptr);
412 main_cookie_store_ = content::CreateCookieStore(cookie_config); 417 main_cookie_store_ = content::CreateCookieStore(cookie_config);
413 418
414 net::URLRequestContext* main_context = new net::URLRequestContext(); 419 net::URLRequestContext* main_context = new net::URLRequestContext();
415 main_context->set_host_resolver(host_resolver_.get()); 420 main_context->set_host_resolver(host_resolver_.get());
416 main_context->set_channel_id_service(channel_id_service_.get()); 421 main_context->set_channel_id_service(channel_id_service_.get());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 if (media_getter_) { 478 if (media_getter_) {
474 media_getter_->GetURLRequestContext() 479 media_getter_->GetURLRequestContext()
475 ->http_transaction_factory() 480 ->http_transaction_factory()
476 ->GetSession() 481 ->GetSession()
477 ->DisableQuic(); 482 ->DisableQuic();
478 } 483 }
479 } 484 }
480 485
481 } // namespace shell 486 } // namespace shell
482 } // namespace chromecast 487 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/url_request_context_factory.h ('k') | components/gcm_driver/gcm_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698