| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "extensions/features/features.h" | 61 #include "extensions/features/features.h" |
| 62 #include "net/base/cache_type.h" | 62 #include "net/base/cache_type.h" |
| 63 #include "net/cookies/cookie_store.h" | 63 #include "net/cookies/cookie_store.h" |
| 64 #include "net/http/http_cache.h" | 64 #include "net/http/http_cache.h" |
| 65 #include "net/http/http_network_session.h" | 65 #include "net/http/http_network_session.h" |
| 66 #include "net/http/http_server_properties_manager.h" | 66 #include "net/http/http_server_properties_manager.h" |
| 67 #include "net/reporting/reporting_feature.h" | 67 #include "net/reporting/reporting_feature.h" |
| 68 #include "net/reporting/reporting_policy.h" | 68 #include "net/reporting/reporting_policy.h" |
| 69 #include "net/reporting/reporting_service.h" | 69 #include "net/reporting/reporting_service.h" |
| 70 #include "net/ssl/channel_id_service.h" | 70 #include "net/ssl/channel_id_service.h" |
| 71 #include "net/url_request/url_request_context_builder.h" | 71 #include "net/url_request/url_request_context_storage.h" |
| 72 #include "net/url_request/url_request_intercepting_job_factory.h" | 72 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 73 #include "net/url_request/url_request_job_factory_impl.h" | 73 #include "net/url_request/url_request_job_factory_impl.h" |
| 74 #include "storage/browser/quota/special_storage_policy.h" | 74 #include "storage/browser/quota/special_storage_policy.h" |
| 75 | 75 |
| 76 #if defined(OS_ANDROID) | 76 #if defined(OS_ANDROID) |
| 77 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor.
h" | 77 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor.
h" |
| 78 #endif // defined(OS_ANDROID) | 78 #endif // defined(OS_ANDROID) |
| 79 | 79 |
| 80 namespace { | 80 namespace { |
| 81 | 81 |
| 82 // Returns the URLRequestContextBuilder::HttpCacheParams::Type that the disk | 82 net::BackendType ChooseCacheBackendType() { |
| 83 // cache should use. | |
| 84 net::URLRequestContextBuilder::HttpCacheParams::Type ChooseCacheType() { | |
| 85 #if !defined(OS_ANDROID) | 83 #if !defined(OS_ANDROID) |
| 86 const base::CommandLine& command_line = | 84 const base::CommandLine& command_line = |
| 87 *base::CommandLine::ForCurrentProcess(); | 85 *base::CommandLine::ForCurrentProcess(); |
| 88 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { | 86 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { |
| 89 const std::string opt_value = | 87 const std::string opt_value = |
| 90 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); | 88 command_line.GetSwitchValueASCII(switches::kUseSimpleCacheBackend); |
| 91 if (base::LowerCaseEqualsASCII(opt_value, "off")) | 89 if (base::LowerCaseEqualsASCII(opt_value, "off")) |
| 92 return net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE; | 90 return net::CACHE_BACKEND_BLOCKFILE; |
| 93 if (opt_value.empty() || base::LowerCaseEqualsASCII(opt_value, "on")) | 91 if (opt_value.empty() || base::LowerCaseEqualsASCII(opt_value, "on")) |
| 94 return net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 92 return net::CACHE_BACKEND_SIMPLE; |
| 95 } | 93 } |
| 96 const std::string experiment_name = | 94 const std::string experiment_name = |
| 97 base::FieldTrialList::FindFullName("SimpleCacheTrial"); | 95 base::FieldTrialList::FindFullName("SimpleCacheTrial"); |
| 98 if (base::StartsWith(experiment_name, "Disable", | 96 if (base::StartsWith(experiment_name, "Disable", |
| 99 base::CompareCase::INSENSITIVE_ASCII)) { | 97 base::CompareCase::INSENSITIVE_ASCII)) { |
| 100 return net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE; | 98 return net::CACHE_BACKEND_BLOCKFILE; |
| 101 } | 99 } |
| 102 if (base::StartsWith(experiment_name, "ExperimentYes", | 100 if (base::StartsWith(experiment_name, "ExperimentYes", |
| 103 base::CompareCase::INSENSITIVE_ASCII)) { | 101 base::CompareCase::INSENSITIVE_ASCII)) { |
| 104 return net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 102 return net::CACHE_BACKEND_SIMPLE; |
| 105 } | 103 } |
| 106 #endif // #if !defined(OS_ANDROID) | 104 #endif // #if !defined(OS_ANDROID) |
| 107 | 105 |
| 108 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) | 106 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 109 return net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE; | 107 return net::CACHE_BACKEND_SIMPLE; |
| 110 #else | 108 #else |
| 111 return net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE; | 109 return net::CACHE_BACKEND_BLOCKFILE; |
| 112 #endif | 110 #endif |
| 113 } | 111 } |
| 114 | 112 |
| 115 // Returns the BackendType that the disk cache should use. | |
| 116 // TODO(mmenke): Once all URLRequestContexts are set up using | |
| 117 // URLRequestContextBuilders, and the media URLRequestContext is take care of | |
| 118 // (In one way or another), this should be removed. | |
| 119 net::BackendType ChooseCacheBackendType() { | |
| 120 switch (ChooseCacheType()) { | |
| 121 case net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE: | |
| 122 return net::CACHE_BACKEND_BLOCKFILE; | |
| 123 case net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE: | |
| 124 return net::CACHE_BACKEND_SIMPLE; | |
| 125 case net::URLRequestContextBuilder::HttpCacheParams::DISK: | |
| 126 return net::CACHE_BACKEND_DEFAULT; | |
| 127 case net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY: | |
| 128 NOTREACHED(); | |
| 129 break; | |
| 130 } | |
| 131 return net::CACHE_BACKEND_DEFAULT; | |
| 132 } | |
| 133 | |
| 134 } // namespace | 113 } // namespace |
| 135 | 114 |
| 136 using content::BrowserThread; | 115 using content::BrowserThread; |
| 137 | 116 |
| 138 ProfileImplIOData::Handle::Handle(Profile* profile) | 117 ProfileImplIOData::Handle::Handle(Profile* profile) |
| 139 : io_data_(new ProfileImplIOData), | 118 : io_data_(new ProfileImplIOData), |
| 140 profile_(profile), | 119 profile_(profile), |
| 141 initialized_(false) { | 120 initialized_(false) { |
| 142 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 121 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 143 DCHECK(profile); | 122 DCHECK(profile); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 452 } |
| 474 | 453 |
| 475 return data_reduction_proxy_io_data()->CreateNetworkDelegate( | 454 return data_reduction_proxy_io_data()->CreateNetworkDelegate( |
| 476 io_thread->globals()->data_use_ascriber->CreateNetworkDelegate( | 455 io_thread->globals()->data_use_ascriber->CreateNetworkDelegate( |
| 477 std::move(chrome_network_delegate), | 456 std::move(chrome_network_delegate), |
| 478 io_thread->GetMetricsDataUseForwarder()), | 457 io_thread->GetMetricsDataUseForwarder()), |
| 479 true); | 458 true); |
| 480 } | 459 } |
| 481 | 460 |
| 482 void ProfileImplIOData::InitializeInternal( | 461 void ProfileImplIOData::InitializeInternal( |
| 483 net::URLRequestContextBuilder* builder, | |
| 484 ProfileParams* profile_params, | 462 ProfileParams* profile_params, |
| 485 content::ProtocolHandlerMap* protocol_handlers, | 463 content::ProtocolHandlerMap* protocol_handlers, |
| 486 content::URLRequestInterceptorScopedVector request_interceptors) const { | 464 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 465 net::URLRequestContext* main_context = main_request_context(); |
| 466 net::URLRequestContextStorage* main_context_storage = |
| 467 main_request_context_storage(); |
| 468 |
| 487 IOThread* const io_thread = profile_params->io_thread; | 469 IOThread* const io_thread = profile_params->io_thread; |
| 488 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 470 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 489 | 471 |
| 490 if (lazy_params_->http_server_properties_manager) { | 472 if (lazy_params_->http_server_properties_manager) { |
| 491 lazy_params_->http_server_properties_manager->InitializeOnNetworkSequence(); | 473 lazy_params_->http_server_properties_manager->InitializeOnNetworkSequence(); |
| 492 builder->SetHttpServerProperties( | 474 main_context_storage->set_http_server_properties( |
| 493 std::move(lazy_params_->http_server_properties_manager)); | 475 std::move(lazy_params_->http_server_properties_manager)); |
| 494 } | 476 } |
| 495 | 477 |
| 496 builder->set_network_quality_estimator( | 478 main_context->set_network_quality_estimator( |
| 497 io_thread_globals->network_quality_estimator.get()); | 479 io_thread_globals->network_quality_estimator.get()); |
| 498 | 480 |
| 499 // Create a single task runner to use with the CookieStore and ChannelIDStore. | 481 // Create a single task runner to use with the CookieStore and ChannelIDStore. |
| 500 scoped_refptr<base::SequencedTaskRunner> cookie_background_task_runner = | 482 scoped_refptr<base::SequencedTaskRunner> cookie_background_task_runner = |
| 501 base::CreateSequencedTaskRunnerWithTraits( | 483 base::CreateSequencedTaskRunnerWithTraits( |
| 502 {base::MayBlock(), base::TaskPriority::BACKGROUND, | 484 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 503 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); | 485 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); |
| 504 | 486 |
| 505 // Set up server bound cert service. | 487 // Set up server bound cert service. |
| 506 DCHECK(!lazy_params_->channel_id_path.empty()); | 488 DCHECK(!lazy_params_->channel_id_path.empty()); |
| 507 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db = | 489 scoped_refptr<QuotaPolicyChannelIDStore> channel_id_db = |
| 508 new QuotaPolicyChannelIDStore(lazy_params_->channel_id_path, | 490 new QuotaPolicyChannelIDStore(lazy_params_->channel_id_path, |
| 509 cookie_background_task_runner, | 491 cookie_background_task_runner, |
| 510 lazy_params_->special_storage_policy.get()); | 492 lazy_params_->special_storage_policy.get()); |
| 511 std::unique_ptr<net::ChannelIDService> channel_id_service( | 493 main_context_storage->set_channel_id_service( |
| 512 base::MakeUnique<net::ChannelIDService>( | 494 base::MakeUnique<net::ChannelIDService>( |
| 513 new net::DefaultChannelIDStore(channel_id_db.get()))); | 495 new net::DefaultChannelIDStore(channel_id_db.get()))); |
| 514 | 496 |
| 515 // Set up cookie store. | 497 // Set up cookie store. |
| 516 DCHECK(!lazy_params_->cookie_path.empty()); | 498 DCHECK(!lazy_params_->cookie_path.empty()); |
| 517 | 499 |
| 518 content::CookieStoreConfig cookie_config( | 500 content::CookieStoreConfig cookie_config( |
| 519 lazy_params_->cookie_path, lazy_params_->session_cookie_mode, | 501 lazy_params_->cookie_path, lazy_params_->session_cookie_mode, |
| 520 lazy_params_->special_storage_policy.get(), | 502 lazy_params_->special_storage_policy.get(), |
| 521 profile_params->cookie_monster_delegate.get()); | 503 profile_params->cookie_monster_delegate.get()); |
| 522 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); | 504 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); |
| 523 cookie_config.channel_id_service = channel_id_service.get(); | 505 cookie_config.channel_id_service = main_context->channel_id_service(); |
| 524 cookie_config.background_task_runner = cookie_background_task_runner; | 506 cookie_config.background_task_runner = cookie_background_task_runner; |
| 525 std::unique_ptr<net::CookieStore> cookie_store( | 507 main_context_storage->set_cookie_store( |
| 526 content::CreateCookieStore(cookie_config)); | 508 content::CreateCookieStore(cookie_config)); |
| 527 | 509 |
| 528 cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID()); | 510 main_context->cookie_store()->SetChannelIDServiceID( |
| 511 main_context->channel_id_service()->GetUniqueID()); |
| 529 | 512 |
| 530 builder->SetCookieAndChannelIdStores(std::move(cookie_store), | 513 std::unique_ptr<net::HttpCache::BackendFactory> main_backend( |
| 531 std::move(channel_id_service)); | 514 new net::HttpCache::DefaultBackend( |
| 515 net::DISK_CACHE, ChooseCacheBackendType(), lazy_params_->cache_path, |
| 516 lazy_params_->cache_max_size, |
| 517 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE))); |
| 518 main_context_storage->set_http_network_session( |
| 519 CreateHttpNetworkSession(*profile_params)); |
| 520 main_context_storage->set_http_transaction_factory(CreateMainHttpFactory( |
| 521 main_context_storage->http_network_session(), std::move(main_backend))); |
| 532 | 522 |
| 533 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 523 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( |
| 534 cache_params.type = ChooseCacheType(); | 524 new net::URLRequestJobFactoryImpl()); |
| 535 cache_params.path = lazy_params_->cache_path; | 525 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); |
| 536 cache_params.max_size = lazy_params_->cache_max_size; | |
| 537 builder->EnableHttpCache(cache_params); | |
| 538 builder->SetCacheThreadTaskRunner( | |
| 539 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)); | |
| 540 | |
| 541 AddProtocolHandlersToBuilder(builder, protocol_handlers); | |
| 542 | 526 |
| 543 // Install the Offline Page Interceptor. | 527 // Install the Offline Page Interceptor. |
| 544 #if defined(OS_ANDROID) | 528 #if defined(OS_ANDROID) |
| 545 request_interceptors.push_back( | 529 request_interceptors.push_back( |
| 546 base::MakeUnique<offline_pages::OfflinePageRequestInterceptor>( | 530 base::MakeUnique<offline_pages::OfflinePageRequestInterceptor>( |
| 547 previews_io_data())); | 531 previews_io_data())); |
| 548 #endif | 532 #endif |
| 549 | 533 |
| 550 // The data reduction proxy interceptor should be as close to the network | 534 // The data reduction proxy interceptor should be as close to the network |
| 551 // as possible. | 535 // as possible. |
| 552 request_interceptors.insert( | 536 request_interceptors.insert( |
| 553 request_interceptors.begin(), | 537 request_interceptors.begin(), |
| 554 data_reduction_proxy_io_data()->CreateInterceptor()); | 538 data_reduction_proxy_io_data()->CreateInterceptor()); |
| 555 data_reduction_proxy_io_data()->SetDataUseAscriber( | 539 data_reduction_proxy_io_data()->SetDataUseAscriber( |
| 556 io_thread_globals->data_use_ascriber.get()); | 540 io_thread_globals->data_use_ascriber.get()); |
| 557 SetUpJobFactoryDefaultsForBuilder( | 541 main_context_storage->set_job_factory(SetUpJobFactoryDefaults( |
| 558 builder, std::move(request_interceptors), | 542 std::move(main_job_factory), std::move(request_interceptors), |
| 559 std::move(profile_params->protocol_handler_interceptor), | 543 std::move(profile_params->protocol_handler_interceptor), |
| 560 io_thread_globals->system_request_context->host_resolver()); | 544 main_context->network_delegate(), |
| 561 | 545 io_thread_globals->system_request_context->host_resolver())); |
| 562 builder->set_reporting_policy(MaybeCreateReportingPolicy()); | |
| 563 } | |
| 564 | |
| 565 void ProfileImplIOData::OnMainRequestContextCreated( | |
| 566 ProfileParams* profile_params) const { | |
| 567 DCHECK(lazy_params_); | |
| 568 | 546 |
| 569 #if BUILDFLAG(ENABLE_EXTENSIONS) | 547 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 570 InitializeExtensionsRequestContext(profile_params); | 548 InitializeExtensionsRequestContext(profile_params); |
| 571 #endif | 549 #endif |
| 572 | 550 |
| 551 main_context_storage->set_reporting_service( |
| 552 MaybeCreateReportingService(main_context)); |
| 553 |
| 573 // Create a media request context based on the main context, but using a | 554 // Create a media request context based on the main context, but using a |
| 574 // media cache. It shares the same job factory as the main context. | 555 // media cache. It shares the same job factory as the main context. |
| 575 StoragePartitionDescriptor details(profile_path_, false); | 556 StoragePartitionDescriptor details(profile_path_, false); |
| 576 media_request_context_.reset(InitializeMediaRequestContext( | 557 media_request_context_.reset( |
| 577 main_request_context(), details, "main_media")); | 558 InitializeMediaRequestContext(main_context, details, "main_media")); |
| 578 lazy_params_.reset(); | 559 lazy_params_.reset(); |
| 579 } | 560 } |
| 580 | 561 |
| 581 void ProfileImplIOData:: | 562 void ProfileImplIOData:: |
| 582 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { | 563 InitializeExtensionsRequestContext(ProfileParams* profile_params) const { |
| 583 // The extensions context only serves to hold onto the extensions cookie | 564 // The extensions context only serves to hold onto the extensions cookie |
| 584 // store. | 565 // store. |
| 585 net::URLRequestContext* extensions_context = extensions_request_context(); | 566 net::URLRequestContext* extensions_context = extensions_request_context(); |
| 586 | 567 |
| 587 content::CookieStoreConfig cookie_config( | 568 content::CookieStoreConfig cookie_config( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 cookie_config.channel_id_service = channel_id_service.get(); | 636 cookie_config.channel_id_service = channel_id_service.get(); |
| 656 cookie_config.background_task_runner = cookie_background_task_runner; | 637 cookie_config.background_task_runner = cookie_background_task_runner; |
| 657 cookie_store = content::CreateCookieStore(cookie_config); | 638 cookie_store = content::CreateCookieStore(cookie_config); |
| 658 cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID()); | 639 cookie_store->SetChannelIDServiceID(channel_id_service->GetUniqueID()); |
| 659 | 640 |
| 660 // Build a new HttpNetworkSession that uses the new ChannelIDService. | 641 // Build a new HttpNetworkSession that uses the new ChannelIDService. |
| 661 // TODO(mmenke): It's weird to combine state from | 642 // TODO(mmenke): It's weird to combine state from |
| 662 // main_request_context_storage() objects and the argumet to this method, | 643 // main_request_context_storage() objects and the argumet to this method, |
| 663 // |main_context|. Remove |main_context| as an argument, and just use | 644 // |main_context|. Remove |main_context| as an argument, and just use |
| 664 // main_context() instead. | 645 // main_context() instead. |
| 665 net::HttpNetworkSession* network_session = | 646 net::HttpNetworkSession::Context session_context = |
| 666 main_context->http_transaction_factory()->GetSession(); | 647 main_request_context_storage()->http_network_session()->context(); |
| 667 net::HttpNetworkSession::Context session_context = network_session->context(); | |
| 668 session_context.channel_id_service = channel_id_service.get(); | 648 session_context.channel_id_service = channel_id_service.get(); |
| 669 std::unique_ptr<net::HttpNetworkSession> http_network_session( | 649 std::unique_ptr<net::HttpNetworkSession> http_network_session( |
| 670 new net::HttpNetworkSession(network_session->params(), session_context)); | 650 new net::HttpNetworkSession( |
| 651 main_request_context_storage()->http_network_session()->params(), |
| 652 session_context)); |
| 671 std::unique_ptr<net::HttpCache> app_http_cache = | 653 std::unique_ptr<net::HttpCache> app_http_cache = |
| 672 CreateMainHttpFactory(http_network_session.get(), std::move(app_backend)); | 654 CreateMainHttpFactory(http_network_session.get(), std::move(app_backend)); |
| 673 | 655 |
| 674 // Transfer ownership of the ChannelIDStore and the HttpNetworkSession to the | 656 // Transfer ownership of the ChannelIDStore and the HttpNetworkSession to the |
| 675 // AppRequestContext. | 657 // AppRequestContext. |
| 676 context->SetChannelIDService(std::move(channel_id_service)); | 658 context->SetChannelIDService(std::move(channel_id_service)); |
| 677 context->SetHttpNetworkSession(std::move(http_network_session)); | 659 context->SetHttpNetworkSession(std::move(http_network_session)); |
| 678 | 660 |
| 679 // Transfer ownership of the cookies and cache to AppRequestContext. | 661 // Transfer ownership of the cookies and cache to AppRequestContext. |
| 680 context->SetCookieStore(std::move(cookie_store)); | 662 context->SetCookieStore(std::move(cookie_store)); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 return media_request_context; | 764 return media_request_context; |
| 783 } | 765 } |
| 784 | 766 |
| 785 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() { | 767 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() { |
| 786 return predictor_.get(); | 768 return predictor_.get(); |
| 787 } | 769 } |
| 788 | 770 |
| 789 std::unique_ptr<net::ReportingService> | 771 std::unique_ptr<net::ReportingService> |
| 790 ProfileImplIOData::MaybeCreateReportingService( | 772 ProfileImplIOData::MaybeCreateReportingService( |
| 791 net::URLRequestContext* url_request_context) const { | 773 net::URLRequestContext* url_request_context) const { |
| 792 std::unique_ptr<net::ReportingPolicy> reporting_policy( | 774 if (!base::FeatureList::IsEnabled(features::kReporting)) |
| 793 MaybeCreateReportingPolicy()); | |
| 794 if (!reporting_policy) | |
| 795 return std::unique_ptr<net::ReportingService>(); | 775 return std::unique_ptr<net::ReportingService>(); |
| 796 | 776 |
| 797 return net::ReportingService::Create(*reporting_policy, url_request_context); | 777 return net::ReportingService::Create(net::ReportingPolicy(), |
| 798 } | 778 url_request_context); |
| 799 | |
| 800 std::unique_ptr<net::ReportingPolicy> | |
| 801 ProfileImplIOData::MaybeCreateReportingPolicy() { | |
| 802 if (!base::FeatureList::IsEnabled(features::kReporting)) | |
| 803 return std::unique_ptr<net::ReportingPolicy>(); | |
| 804 | |
| 805 return base::MakeUnique<net::ReportingPolicy>(); | |
| 806 } | 779 } |
| 807 | 780 |
| 808 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 781 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| 809 base::Time time, | 782 base::Time time, |
| 810 const base::Closure& completion) { | 783 const base::Closure& completion) { |
| 811 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 784 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 812 DCHECK(initialized()); | 785 DCHECK(initialized()); |
| 813 | 786 |
| 814 // Completes synchronously. | 787 // Completes synchronously. |
| 815 main_request_context()->transport_security_state()->DeleteAllDynamicDataSince( | 788 main_request_context()->transport_security_state()->DeleteAllDynamicDataSince( |
| 816 time); | 789 time); |
| 817 DCHECK(http_server_properties_manager_); | 790 DCHECK(http_server_properties_manager_); |
| 818 http_server_properties_manager_->Clear(completion); | 791 http_server_properties_manager_->Clear(completion); |
| 819 } | 792 } |
| OLD | NEW |