| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 net::ct::EVPolicyCompliance DoesConformToCTEVPolicy( | 67 net::ct::EVPolicyCompliance DoesConformToCTEVPolicy( |
| 68 net::X509Certificate* cert, | 68 net::X509Certificate* cert, |
| 69 const net::ct::EVCertsWhitelist* ev_whitelist, | 69 const net::ct::EVCertsWhitelist* ev_whitelist, |
| 70 const net::SCTList& verified_scts, | 70 const net::SCTList& verified_scts, |
| 71 const net::NetLogWithSource& net_log) override { | 71 const net::NetLogWithSource& net_log) override { |
| 72 return net::ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY; | 72 return net::ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY; |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 bool IgnoreCertificateErrors() { |
| 77 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 78 return cmd_line->HasSwitch(switches::kIgnoreCertificateErrors); |
| 79 } |
| 80 |
| 76 } // namespace | 81 } // namespace |
| 77 | 82 |
| 78 // Private classes to expose URLRequestContextGetter that call back to the | 83 // Private classes to expose URLRequestContextGetter that call back to the |
| 79 // URLRequestContextFactory to create the URLRequestContext on demand. | 84 // URLRequestContextFactory to create the URLRequestContext on demand. |
| 80 // | 85 // |
| 81 // The URLRequestContextFactory::URLRequestContextGetter class is used for both | 86 // The URLRequestContextFactory::URLRequestContextGetter class is used for both |
| 82 // the system and media URLRequestCotnexts. | 87 // the system and media URLRequestCotnexts. |
| 83 class URLRequestContextFactory::URLRequestContextGetter | 88 class URLRequestContextFactory::URLRequestContextGetter |
| 84 : public net::URLRequestContextGetter { | 89 : public net::URLRequestContextGetter { |
| 85 public: | 90 public: |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 params->proxy_service = proxy_service_.get(); | 334 params->proxy_service = proxy_service_.get(); |
| 330 | 335 |
| 331 LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " << enable_quic_; | 336 LOG(INFO) << "Set HttpNetworkSessionParams.enable_quic = " << enable_quic_; |
| 332 params->enable_quic = enable_quic_; | 337 params->enable_quic = enable_quic_; |
| 333 } | 338 } |
| 334 | 339 |
| 335 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { | 340 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { |
| 336 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 341 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 337 InitializeSystemContextDependencies(); | 342 InitializeSystemContextDependencies(); |
| 338 net::HttpNetworkSession::Params system_params; | 343 net::HttpNetworkSession::Params system_params; |
| 339 PopulateNetworkSessionParams(false, &system_params); | 344 PopulateNetworkSessionParams(IgnoreCertificateErrors(), &system_params); |
| 340 system_transaction_factory_.reset(new net::HttpNetworkLayer( | 345 system_transaction_factory_.reset(new net::HttpNetworkLayer( |
| 341 new net::HttpNetworkSession(system_params))); | 346 new net::HttpNetworkSession(system_params))); |
| 342 system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); | 347 system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); |
| 343 system_cookie_store_ = | 348 system_cookie_store_ = |
| 344 content::CreateCookieStore(content::CookieStoreConfig()); | 349 content::CreateCookieStore(content::CookieStoreConfig()); |
| 345 | 350 |
| 346 net::URLRequestContext* system_context = new net::URLRequestContext(); | 351 net::URLRequestContext* system_context = new net::URLRequestContext(); |
| 347 system_context->set_host_resolver(host_resolver_.get()); | 352 system_context->set_host_resolver(host_resolver_.get()); |
| 348 system_context->set_channel_id_service(channel_id_service_.get()); | 353 system_context->set_channel_id_service(channel_id_service_.get()); |
| 349 system_context->set_cert_verifier(cert_verifier_.get()); | 354 system_context->set_cert_verifier(cert_verifier_.get()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return media_context; | 390 return media_context; |
| 386 } | 391 } |
| 387 | 392 |
| 388 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( | 393 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( |
| 389 const base::FilePath& cookie_path, | 394 const base::FilePath& cookie_path, |
| 390 content::ProtocolHandlerMap* protocol_handlers, | 395 content::ProtocolHandlerMap* protocol_handlers, |
| 391 content::URLRequestInterceptorScopedVector request_interceptors) { | 396 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 392 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 397 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 393 InitializeSystemContextDependencies(); | 398 InitializeSystemContextDependencies(); |
| 394 | 399 |
| 395 bool ignore_certificate_errors = false; | |
| 396 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 397 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) { | |
| 398 ignore_certificate_errors = true; | |
| 399 } | |
| 400 net::HttpNetworkSession::Params network_session_params; | 400 net::HttpNetworkSession::Params network_session_params; |
| 401 PopulateNetworkSessionParams(ignore_certificate_errors, | 401 PopulateNetworkSessionParams(IgnoreCertificateErrors(), |
| 402 &network_session_params); | 402 &network_session_params); |
| 403 InitializeMainContextDependencies( | 403 InitializeMainContextDependencies( |
| 404 new net::HttpNetworkLayer( | 404 new net::HttpNetworkLayer( |
| 405 new net::HttpNetworkSession(network_session_params)), | 405 new net::HttpNetworkSession(network_session_params)), |
| 406 protocol_handlers, std::move(request_interceptors)); | 406 protocol_handlers, std::move(request_interceptors)); |
| 407 | 407 |
| 408 content::CookieStoreConfig cookie_config( | 408 content::CookieStoreConfig cookie_config( |
| 409 cookie_path, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, | 409 cookie_path, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, |
| 410 nullptr, nullptr); | 410 nullptr, nullptr); |
| 411 main_cookie_store_ = content::CreateCookieStore(cookie_config); | 411 main_cookie_store_ = content::CreateCookieStore(cookie_config); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (media_getter_) { | 472 if (media_getter_) { |
| 473 media_getter_->GetURLRequestContext() | 473 media_getter_->GetURLRequestContext() |
| 474 ->http_transaction_factory() | 474 ->http_transaction_factory() |
| 475 ->GetSession() | 475 ->GetSession() |
| 476 ->DisableQuic(); | 476 ->DisableQuic(); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace shell | 480 } // namespace shell |
| 481 } // namespace chromecast | 481 } // namespace chromecast |
| OLD | NEW |