This repository has been archived by the owner on Mar 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
0002-fix-building-without-reporting.patch
67 lines (60 loc) · 2.98 KB
/
0002-fix-building-without-reporting.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 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<base::Value> body) {
+#if BUILDFLAG(ENABLE_REPORTING)
net::URLRequestContext* request_context =
request_context_getter_->GetURLRequestContext();
if (!request_context) {
@@ -120,6 +121,7 @@ class ReportingServiceProxyImpl : public
// renderer.
reporting_service->QueueReport(url, group, type, std::move(body),
/* depth= */ 0);
+#endif
}
scoped_refptr<net::URLRequestContextGetter> 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<net::ReportingPolicy> MaybeCreateReportingPolicy();
+#endif
// Lazy initialization params.
mutable std::unique_ptr<LazyParams> lazy_params_;
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -623,7 +623,9 @@ void ProfileIOData::AppRequestContext::S
void ProfileIOData::AppRequestContext::SetReportingService(
std::unique_ptr<net::ReportingService> 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
@@ -271,10 +271,12 @@ void ClearReportingCacheOnIOThread(
const base::RepeatingCallback<bool(const GURL&)>& 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(