| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
| 11 #include "chromecast/browser/cast_http_user_agent_settings.h" | 11 #include "chromecast/browser/cast_http_user_agent_settings.h" |
| 12 #include "chromecast/browser/cast_network_delegate.h" | 12 #include "chromecast/browser/cast_network_delegate.h" |
| 13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/cookie_store_factory.h" | 15 #include "content/public/browser/cookie_store_factory.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| 18 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
| 19 #include "net/cookies/cookie_store.h" | 19 #include "net/cookies/cookie_store.h" |
| 20 #include "net/dns/host_resolver.h" | 20 #include "net/dns/host_resolver.h" |
| 21 #include "net/http/http_auth_handler_factory.h" | 21 #include "net/http/http_auth_handler_factory.h" |
| 22 #include "net/http/http_cache.h" | |
| 23 #include "net/http/http_network_layer.h" | 22 #include "net/http/http_network_layer.h" |
| 24 #include "net/http/http_server_properties_impl.h" | 23 #include "net/http/http_server_properties_impl.h" |
| 25 #include "net/http/http_stream_factory.h" | 24 #include "net/http/http_stream_factory.h" |
| 26 #include "net/ocsp/nss_ocsp.h" | 25 #include "net/ocsp/nss_ocsp.h" |
| 27 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 28 #include "net/socket/next_proto.h" | 27 #include "net/socket/next_proto.h" |
| 29 #include "net/ssl/channel_id_service.h" | 28 #include "net/ssl/channel_id_service.h" |
| 30 #include "net/ssl/default_channel_id_store.h" | 29 #include "net/ssl/default_channel_id_store.h" |
| 31 #include "net/ssl/ssl_config_service_defaults.h" | 30 #include "net/ssl/ssl_config_service_defaults.h" |
| 32 #include "net/url_request/data_protocol_handler.h" | 31 #include "net/url_request/data_protocol_handler.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return media_context; | 347 return media_context; |
| 349 } | 348 } |
| 350 | 349 |
| 351 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( | 350 net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( |
| 352 content::BrowserContext* browser_context, | 351 content::BrowserContext* browser_context, |
| 353 content::ProtocolHandlerMap* protocol_handlers, | 352 content::ProtocolHandlerMap* protocol_handlers, |
| 354 content::URLRequestInterceptorScopedVector request_interceptors) { | 353 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 355 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 354 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 356 InitializeSystemContextDependencies(); | 355 InitializeSystemContextDependencies(); |
| 357 | 356 |
| 358 net::HttpCache::BackendFactory* main_backend = | |
| 359 net::HttpCache::DefaultBackend::InMemory(16 * 1024 * 1024); | |
| 360 | |
| 361 bool ignore_certificate_errors = false; | 357 bool ignore_certificate_errors = false; |
| 362 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 358 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 363 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) { | 359 if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) { |
| 364 ignore_certificate_errors = true; | 360 ignore_certificate_errors = true; |
| 365 } | 361 } |
| 366 net::HttpNetworkSession::Params network_session_params; | 362 net::HttpNetworkSession::Params network_session_params; |
| 367 PopulateNetworkSessionParams(ignore_certificate_errors, | 363 PopulateNetworkSessionParams(ignore_certificate_errors, |
| 368 &network_session_params); | 364 &network_session_params); |
| 369 InitializeMainContextDependencies( | 365 InitializeMainContextDependencies( |
| 370 new net::HttpCache(network_session_params, main_backend), | 366 new net::HttpNetworkLayer( |
| 367 new net::HttpNetworkSession(network_session_params)), |
| 371 protocol_handlers, | 368 protocol_handlers, |
| 372 request_interceptors.Pass()); | 369 request_interceptors.Pass()); |
| 373 | 370 |
| 374 content::CookieStoreConfig cookie_config( | 371 content::CookieStoreConfig cookie_config( |
| 375 browser_context->GetPath().Append(kCookieStoreFile), | 372 browser_context->GetPath().Append(kCookieStoreFile), |
| 376 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, | 373 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, |
| 377 NULL, NULL); | 374 NULL, NULL); |
| 378 cookie_config.background_task_runner = | 375 cookie_config.background_task_runner = |
| 379 scoped_refptr<base::SequencedTaskRunner>(); | 376 scoped_refptr<base::SequencedTaskRunner>(); |
| 380 scoped_refptr<net::CookieStore> cookie_store = | 377 scoped_refptr<net::CookieStore> cookie_store = |
| (...skipping 23 matching lines...) Expand all Loading... |
| 404 | 401 |
| 405 void URLRequestContextFactory::InitializeNetworkDelegates() { | 402 void URLRequestContextFactory::InitializeNetworkDelegates() { |
| 406 app_network_delegate_->Initialize(false); | 403 app_network_delegate_->Initialize(false); |
| 407 LOG(INFO) << "Initialized app network delegate."; | 404 LOG(INFO) << "Initialized app network delegate."; |
| 408 system_network_delegate_->Initialize(false); | 405 system_network_delegate_->Initialize(false); |
| 409 LOG(INFO) << "Initialized system network delegate."; | 406 LOG(INFO) << "Initialized system network delegate."; |
| 410 } | 407 } |
| 411 | 408 |
| 412 } // namespace shell | 409 } // namespace shell |
| 413 } // namespace chromecast | 410 } // namespace chromecast |
| OLD | NEW |