# Fix building with enable_reporting=false # In profile_impl_io_data.h/cc and reporting_service_proxy.cc the devs forgot to check if reporting was enabled before using a reporting feature # In printer_handler.cc, due to some combination of build flags used in the ungoogled-chromium build, MakeUnique was not pulled in --- a/content/browser/net/reporting_service_proxy.cc +++ b/content/browser/net/reporting_service_proxy.cc @@ -102,6 +102,7 @@ class ReportingServiceProxyImpl : public const std::string& group, const std::string& type, std::unique_ptr body) { +#if BUILDFLAG(ENABLE_REPORTING) net::URLRequestContext* request_context = request_context_getter_->GetURLRequestContext(); if (!request_context) { @@ -117,6 +118,7 @@ class ReportingServiceProxyImpl : public } reporting_service->QueueReport(url, group, type, std::move(body)); +#endif } scoped_refptr request_context_getter_; --- a/chrome/browser/profiles/profile_impl_io_data.h +++ b/chrome/browser/profiles/profile_impl_io_data.h @@ -179,6 +179,7 @@ class ProfileImplIOData : public Profile const StoragePartitionDescriptor& partition_descriptor) const override; chrome_browser_net::Predictor* GetPredictor() override; +#if BUILDFLAG(ENABLE_REPORTING) // Returns a net::ReportingService, if reporting should be enabled. Otherwise, // returns nullptr. // TODO(mmenke): Remove once URLRequestContextBuilders are always used to @@ -189,6 +190,7 @@ class ProfileImplIOData : public Profile // Returns a net::ReportingPolicy, if reporting should be enabled. Otherwise, // returns nullptr. static std::unique_ptr MaybeCreateReportingPolicy(); +#endif // Lazy initialization params. mutable std::unique_ptr lazy_params_; --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -630,7 +630,9 @@ void ProfileIOData::AppRequestContext::S void ProfileIOData::AppRequestContext::SetReportingService( std::unique_ptr reporting_service) { reporting_service_ = std::move(reporting_service); +#if BUILDFLAG(ENABLE_REPORTING) set_reporting_service(reporting_service_.get()); +#endif } void ProfileIOData::AppRequestContext::SetNetworkErrorLoggingService( --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc @@ -268,10 +268,12 @@ void ClearReportingCacheOnIOThread( const base::RepeatingCallback& origin_filter) { DCHECK_CURRENTLY_ON(BrowserThread::IO); +#if BUILDFLAG(ENABLE_REPORTING) net::ReportingService* service = context->GetURLRequestContext()->reporting_service(); if (service) service->RemoveBrowsingData(data_type_mask, origin_filter); +#endif } void ClearNetworkErrorLoggingOnIOThread(