Index: chrome/browser/profiles/profile_impl_io_data.cc |
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc |
index c4fe90c0986e7023897ced4209a3ec270d5ec8b5..ae46c2ba5428e59892f0c77cdfd96cd0a70707e4 100644 |
--- a/chrome/browser/profiles/profile_impl_io_data.cc |
+++ b/chrome/browser/profiles/profile_impl_io_data.cc |
@@ -65,6 +65,9 @@ |
#include "net/http/http_cache.h" |
#include "net/http/http_network_session.h" |
#include "net/http/http_server_properties_manager.h" |
+#include "net/reporting/reporting_feature.h" |
+#include "net/reporting/reporting_policy.h" |
+#include "net/reporting/reporting_service.h" |
#include "net/ssl/channel_id_service.h" |
#include "net/url_request/url_request_context_storage.h" |
#include "net/url_request/url_request_intercepting_job_factory.h" |
@@ -552,6 +555,9 @@ void ProfileImplIOData::InitializeInternal( |
InitializeExtensionsRequestContext(profile_params); |
#endif |
+ main_context_storage->set_reporting_service( |
+ MaybeCreateReportingService(main_context)); |
+ |
// Create a media request context based on the main context, but using a |
// media cache. It shares the same job factory as the main context. |
StoragePartitionDescriptor details(profile_path_, false); |
@@ -696,6 +702,8 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext( |
context->host_resolver())); |
context->SetJobFactory(std::move(top_job_factory)); |
+ context->SetReportingService(MaybeCreateReportingService(context)); |
+ |
return context; |
} |
@@ -784,6 +792,16 @@ chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() { |
return predictor_.get(); |
} |
+std::unique_ptr<net::ReportingService> |
+ProfileImplIOData::MaybeCreateReportingService( |
+ net::URLRequestContext* url_request_context) const { |
+ if (!base::FeatureList::IsEnabled(features::kReporting)) |
+ return std::unique_ptr<net::ReportingService>(); |
+ |
+ return net::ReportingService::Create(net::ReportingPolicy(), |
+ url_request_context); |
+} |
+ |
void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
base::Time time, |
const base::Closure& completion) { |