| 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 "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 ProfileImplIOData::~ProfileImplIOData() { | 428 ProfileImplIOData::~ProfileImplIOData() { |
| 429 if (domain_reliability_monitor_) | 429 if (domain_reliability_monitor_) |
| 430 domain_reliability_monitor_->Shutdown(); | 430 domain_reliability_monitor_->Shutdown(); |
| 431 | 431 |
| 432 DestroyResourceContext(); | 432 DestroyResourceContext(); |
| 433 | 433 |
| 434 if (media_request_context_) | 434 if (media_request_context_) |
| 435 media_request_context_->AssertNoURLRequests(); | 435 media_request_context_->AssertNoURLRequests(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 std::unique_ptr<net::NetworkDelegate> | |
| 439 ProfileImplIOData::ConfigureNetworkDelegate( | |
| 440 IOThread* io_thread, | |
| 441 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const { | |
| 442 if (lazy_params_->domain_reliability_monitor) { | |
| 443 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. | |
| 444 domain_reliability_monitor_ = | |
| 445 lazy_params_->domain_reliability_monitor.get(); | |
| 446 | |
| 447 domain_reliability_monitor_->InitURLRequestContext(main_request_context()); | |
| 448 domain_reliability_monitor_->AddBakedInConfigs(); | |
| 449 domain_reliability_monitor_->SetDiscardUploads( | |
| 450 !GetMetricsEnabledStateOnIOThread()); | |
| 451 | |
| 452 chrome_network_delegate->set_domain_reliability_monitor( | |
| 453 std::move(lazy_params_->domain_reliability_monitor)); | |
| 454 } | |
| 455 | |
| 456 return data_reduction_proxy_io_data()->CreateNetworkDelegate( | |
| 457 io_thread->globals()->data_use_ascriber->CreateNetworkDelegate( | |
| 458 std::move(chrome_network_delegate), | |
| 459 io_thread->GetMetricsDataUseForwarder()), | |
| 460 true); | |
| 461 } | |
| 462 | |
| 463 void ProfileImplIOData::InitializeInternal( | 438 void ProfileImplIOData::InitializeInternal( |
| 439 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, |
| 464 ProfileParams* profile_params, | 440 ProfileParams* profile_params, |
| 465 content::ProtocolHandlerMap* protocol_handlers, | 441 content::ProtocolHandlerMap* protocol_handlers, |
| 466 content::URLRequestInterceptorScopedVector request_interceptors) const { | 442 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 467 net::URLRequestContext* main_context = main_request_context(); | 443 net::URLRequestContext* main_context = main_request_context(); |
| 468 net::URLRequestContextStorage* main_context_storage = | 444 net::URLRequestContextStorage* main_context_storage = |
| 469 main_request_context_storage(); | 445 main_request_context_storage(); |
| 470 | 446 |
| 471 IOThread* const io_thread = profile_params->io_thread; | 447 IOThread* const io_thread = profile_params->io_thread; |
| 472 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 448 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 473 | 449 |
| 450 if (lazy_params_->domain_reliability_monitor) { |
| 451 // Hold on to a raw pointer to call Shutdown() in ~ProfileImplIOData. |
| 452 domain_reliability_monitor_ = |
| 453 lazy_params_->domain_reliability_monitor.get(); |
| 454 |
| 455 domain_reliability_monitor_->InitURLRequestContext(main_context); |
| 456 domain_reliability_monitor_->AddBakedInConfigs(); |
| 457 domain_reliability_monitor_->SetDiscardUploads( |
| 458 !GetMetricsEnabledStateOnIOThread()); |
| 459 |
| 460 chrome_network_delegate->set_domain_reliability_monitor( |
| 461 std::move(lazy_params_->domain_reliability_monitor)); |
| 462 } |
| 463 |
| 474 ApplyProfileParamsToContext(main_context); | 464 ApplyProfileParamsToContext(main_context); |
| 475 | 465 |
| 476 if (lazy_params_->http_server_properties_manager) { | 466 if (lazy_params_->http_server_properties_manager) { |
| 477 lazy_params_->http_server_properties_manager->InitializeOnNetworkThread(); | 467 lazy_params_->http_server_properties_manager->InitializeOnNetworkThread(); |
| 478 main_context_storage->set_http_server_properties( | 468 main_context_storage->set_http_server_properties( |
| 479 std::move(lazy_params_->http_server_properties_manager)); | 469 std::move(lazy_params_->http_server_properties_manager)); |
| 480 } | 470 } |
| 481 | 471 |
| 482 main_context->set_transport_security_state(transport_security_state()); | 472 main_context->set_transport_security_state(transport_security_state()); |
| 483 main_context->set_ct_policy_enforcer( | 473 main_context->set_ct_policy_enforcer( |
| 484 io_thread_globals->ct_policy_enforcer.get()); | 474 io_thread_globals->ct_policy_enforcer.get()); |
| 485 | 475 |
| 486 main_context->set_net_log(io_thread->net_log()); | 476 main_context->set_net_log(io_thread->net_log()); |
| 487 | 477 |
| 478 main_context_storage->set_network_delegate( |
| 479 data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| 480 io_thread_globals->data_use_ascriber->CreateNetworkDelegate( |
| 481 std::move(chrome_network_delegate), |
| 482 io_thread->GetMetricsDataUseForwarder()), |
| 483 true)); |
| 484 |
| 485 main_context->set_host_resolver( |
| 486 io_thread_globals->host_resolver.get()); |
| 487 |
| 488 main_context->set_http_auth_handler_factory( | 488 main_context->set_http_auth_handler_factory( |
| 489 io_thread_globals->http_auth_handler_factory.get()); | 489 io_thread_globals->http_auth_handler_factory.get()); |
| 490 | 490 |
| 491 main_context->set_proxy_service(proxy_service()); | 491 main_context->set_proxy_service(proxy_service()); |
| 492 | 492 |
| 493 // Set up cookie store. | 493 // Set up cookie store. |
| 494 DCHECK(!lazy_params_->cookie_path.empty()); | 494 DCHECK(!lazy_params_->cookie_path.empty()); |
| 495 | 495 |
| 496 content::CookieStoreConfig cookie_config( | 496 content::CookieStoreConfig cookie_config( |
| 497 lazy_params_->cookie_path, lazy_params_->session_cookie_mode, | 497 lazy_params_->cookie_path, lazy_params_->session_cookie_mode, |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 const base::Closure& completion) { | 807 const base::Closure& completion) { |
| 808 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 808 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 809 DCHECK(initialized()); | 809 DCHECK(initialized()); |
| 810 | 810 |
| 811 DCHECK(transport_security_state()); | 811 DCHECK(transport_security_state()); |
| 812 // Completes synchronously. | 812 // Completes synchronously. |
| 813 transport_security_state()->DeleteAllDynamicDataSince(time); | 813 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 814 DCHECK(http_server_properties_manager_); | 814 DCHECK(http_server_properties_manager_); |
| 815 http_server_properties_manager_->Clear(completion); | 815 http_server_properties_manager_->Clear(completion); |
| 816 } | 816 } |
| OLD | NEW |