fix-building-without-enabling-reporting.patch 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. --- a/content/browser/BUILD.gn
  2. +++ b/content/browser/BUILD.gn
  3. @@ -1150,6 +1150,10 @@ source_set("browser") {
  4. "net/browser_online_state_observer.cc",
  5. "net/browser_online_state_observer.h",
  6. "net/cookie_store_factory.cc",
  7. + "net/cross_origin_embedder_policy_reporter.cc",
  8. + "net/cross_origin_embedder_policy_reporter.h",
  9. + "net/cross_origin_opener_policy_reporter.cc",
  10. + "net/cross_origin_opener_policy_reporter.h",
  11. "net/network_errors_listing_ui.cc",
  12. "net/network_errors_listing_ui.h",
  13. "net/network_quality_observer_impl.cc",
  14. @@ -2796,10 +2800,6 @@ source_set("browser") {
  15. if (enable_reporting) {
  16. sources += [
  17. - "net/cross_origin_embedder_policy_reporter.cc",
  18. - "net/cross_origin_embedder_policy_reporter.h",
  19. - "net/cross_origin_opener_policy_reporter.cc",
  20. - "net/cross_origin_opener_policy_reporter.h",
  21. "net/reporting_service_proxy.cc",
  22. "net/reporting_service_proxy.h",
  23. ]
  24. --- a/third_party/blink/renderer/core/frame/local_frame.cc
  25. +++ b/third_party/blink/renderer/core/frame/local_frame.cc
  26. @@ -38,6 +38,7 @@
  27. #include "base/unguessable_token.h"
  28. #include "mojo/public/cpp/bindings/self_owned_receiver.h"
  29. #include "mojo/public/cpp/system/message_pipe.h"
  30. +#include "net/net_buildflags.h"
  31. #include "services/data_decoder/public/mojom/resource_snapshot_for_web_bundle.mojom-blink.h"
  32. #include "services/network/public/cpp/features.h"
  33. #include "services/network/public/mojom/content_security_policy.mojom-blink.h"
  34. @@ -551,7 +552,9 @@ void LocalFrame::Trace(Visitor* visitor)
  35. visitor->Trace(raw_system_clipboard_);
  36. visitor->Trace(virtual_keyboard_overlay_changed_observers_);
  37. visitor->Trace(pause_handle_receivers_);
  38. +#if BUILDFLAG(ENABLE_REPORTING)
  39. visitor->Trace(reporting_service_);
  40. +#endif
  41. #if defined(OS_MAC)
  42. visitor->Trace(text_input_host_);
  43. #endif
  44. @@ -2273,6 +2276,7 @@ const base::UnguessableToken& LocalFrame
  45. return base::UnguessableToken::Null();
  46. }
  47. +#if BUILDFLAG(ENABLE_REPORTING)
  48. mojom::blink::ReportingServiceProxy* LocalFrame::GetReportingService() {
  49. if (!reporting_service_.is_bound()) {
  50. GetBrowserInterfaceBroker().GetInterface(
  51. @@ -2281,6 +2285,7 @@ mojom::blink::ReportingServiceProxy* Loc
  52. }
  53. return reporting_service_.get();
  54. }
  55. +#endif
  56. // static
  57. void LocalFrame::NotifyUserActivation(
  58. --- a/third_party/blink/renderer/core/frame/local_frame.h
  59. +++ b/third_party/blink/renderer/core/frame/local_frame.h
  60. @@ -38,6 +38,7 @@
  61. #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
  62. #include "mojo/public/cpp/bindings/pending_receiver.h"
  63. #include "mojo/public/cpp/bindings/unique_receiver_set.h"
  64. +#include "net/net_buildflags.h"
  65. #include "third_party/blink/public/common/frame/transient_allow_fullscreen.h"
  66. #include "third_party/blink/public/mojom/blob/blob_url_store.mojom-blink.h"
  67. #include "third_party/blink/public/mojom/frame/back_forward_cache_controller.mojom-blink.h"
  68. @@ -521,9 +522,9 @@ class CORE_EXPORT LocalFrame final
  69. }
  70. SmoothScrollSequencer& GetSmoothScrollSequencer();
  71. -
  72. +#if BUILDFLAG(ENABLE_REPORTING)
  73. mojom::blink::ReportingServiceProxy* GetReportingService();
  74. -
  75. +#endif
  76. // Returns the frame host ptr. The interface returned is backed by an
  77. // associated interface with the legacy Chrome IPC channel.
  78. mojom::blink::LocalFrameHost& GetLocalFrameHostRemote() const;
  79. @@ -903,9 +904,11 @@ class CORE_EXPORT LocalFrame final
  80. // const methods.
  81. //
  82. // LocalFrame can be reused by multiple ExecutionContext.
  83. +#if BUILDFLAG(ENABLE_REPORTING)
  84. mutable HeapMojoRemote<mojom::blink::ReportingServiceProxy,
  85. HeapMojoWrapperMode::kWithoutContextObserver>
  86. reporting_service_{nullptr};
  87. +#endif
  88. #if defined(OS_MAC)
  89. // LocalFrame can be reused by multiple ExecutionContext.
  90. --- a/third_party/blink/renderer/core/frame/reporting_context.cc
  91. +++ b/third_party/blink/renderer/core/frame/reporting_context.cc
  92. @@ -4,6 +4,7 @@
  93. #include "third_party/blink/renderer/core/frame/reporting_context.h"
  94. +#include "net/net_buildflags.h"
  95. #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
  96. #include "third_party/blink/public/platform/platform.h"
  97. #include "third_party/blink/public/platform/task_type.h"
  98. @@ -54,7 +55,9 @@ const char ReportingContext::kSupplement
  99. ReportingContext::ReportingContext(ExecutionContext& context)
  100. : Supplement<ExecutionContext>(context),
  101. execution_context_(context),
  102. +#if BUILDFLAG(ENABLE_REPORTING)
  103. reporting_service_(&context),
  104. +#endif
  105. receiver_(this, &context) {}
  106. // static
  107. @@ -118,7 +121,9 @@ void ReportingContext::Trace(Visitor* vi
  108. visitor->Trace(observers_);
  109. visitor->Trace(report_buffer_);
  110. visitor->Trace(execution_context_);
  111. +#if BUILDFLAG(ENABLE_REPORTING)
  112. visitor->Trace(reporting_service_);
  113. +#endif
  114. visitor->Trace(receiver_);
  115. Supplement<ExecutionContext>::Trace(visitor);
  116. }
  117. @@ -140,6 +145,7 @@ void ReportingContext::CountReport(Repor
  118. UseCounter::Count(execution_context_, feature);
  119. }
  120. +#if BUILDFLAG(ENABLE_REPORTING)
  121. const HeapMojoRemote<mojom::blink::ReportingServiceProxy>&
  122. ReportingContext::GetReportingService() const {
  123. if (!reporting_service_.is_bound()) {
  124. @@ -149,6 +155,7 @@ ReportingContext::GetReportingService()
  125. }
  126. return reporting_service_;
  127. }
  128. +#endif
  129. void ReportingContext::NotifyInternal(Report* report) {
  130. // Buffer the report.
  131. @@ -171,6 +178,7 @@ void ReportingContext::NotifyInternal(Re
  132. void ReportingContext::SendToReportingAPI(Report* report,
  133. const String& endpoint) const {
  134. +#if BUILDFLAG(ENABLE_REPORTING)
  135. const String& type = report->type();
  136. if (!(type == ReportType::kCSPViolation || type == ReportType::kDeprecation ||
  137. type == ReportType::kFeaturePolicyViolation ||
  138. @@ -227,6 +235,7 @@ void ReportingContext::SendToReportingAP
  139. "Document policy violation", body->sourceFile(), line_number,
  140. column_number);
  141. }
  142. +#endif
  143. }
  144. } // namespace blink
  145. --- a/third_party/blink/renderer/core/frame/reporting_context.h
  146. +++ b/third_party/blink/renderer/core/frame/reporting_context.h
  147. @@ -5,6 +5,7 @@
  148. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_
  149. #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_REPORTING_CONTEXT_H_
  150. +#include "net/net_buildflags.h"
  151. #include "third_party/blink/public/mojom/frame/reporting_observer.mojom-blink.h"
  152. #include "third_party/blink/public/mojom/reporting/reporting.mojom-blink.h"
  153. #include "third_party/blink/renderer/core/core_export.h"
  154. @@ -53,10 +54,10 @@ class CORE_EXPORT ReportingContext : pub
  155. private:
  156. // Counts the use of a report type via UseCounter.
  157. void CountReport(Report*);
  158. -
  159. +#if BUILDFLAG(ENABLE_REPORTING)
  160. const HeapMojoRemote<mojom::blink::ReportingServiceProxy>&
  161. GetReportingService() const;
  162. -
  163. +#endif
  164. void NotifyInternal(Report* report);
  165. // Send |report| via the Reporting API to |endpoint|.
  166. void SendToReportingAPI(Report* report, const String& endpoint) const;
  167. @@ -67,8 +68,10 @@ class CORE_EXPORT ReportingContext : pub
  168. // This is declared mutable so that the service endpoint can be cached by
  169. // const methods.
  170. +#if BUILDFLAG(ENABLE_REPORTING)
  171. mutable HeapMojoRemote<mojom::blink::ReportingServiceProxy>
  172. reporting_service_;
  173. +#endif
  174. HeapMojoReceiver<mojom::blink::ReportingObserver, ReportingContext> receiver_;
  175. };