[CBCM] Refactor ReportScheduler to use delegate pattern
Moves all platform-specific logic in ReportScheduler to a delegate
class. A few things to note:
- For now, ReportScheduler takes the desktop-specific factory in its
constructor because it can't use the base factory until
ReportScheduler is moved to components.
- Observing the build state is now done by the desktop delegate. To
notify ReportScheduler of an update, ReportScheduler passes a
callback to its delegate, which the delegate can use to trigger
report uploads. For this to work, the ReportTrigger enum had to be
made visible to the delegate.
- ReportScheduler still has one chrome/browser dependency for the name
of the kLastUploadTimestamp pref. This pref name will be moved to
components in the next CL.
- On Chrome OS, ReportScheduler was being given a specific profile to
watch. Because Profile cannot be used in Components, the Profile*
must now be passed to the delegate directly. So, on Chrome OS, the
ReportSchedulerDesktop delegate is instantiated directly and passed
to ReportScheduler, instead of ReportScheduler taking the delegate
from the factory.
Bug: 1092432
Change-Id: Ia3169410c8ca83151556fed4319db512bc9fc258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303589
Commit-Queue: Guillaume Jenkins <[email protected]>
Reviewed-by: Maksim Ivanov <[email protected]>
Reviewed-by: Owen Min <[email protected]>
Cr-Commit-Position: refs/heads/master@{#790848}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 6234bce5..7ca0c63ea 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3140,6 +3140,8 @@
"enterprise/reporting/report_generator_desktop.h",
"enterprise/reporting/report_scheduler.cc",
"enterprise/reporting/report_scheduler.h",
+ "enterprise/reporting/report_scheduler_desktop.cc",
+ "enterprise/reporting/report_scheduler_desktop.h",
"enterprise/reporting/reporting_delegate_factory_desktop.cc",
"enterprise/reporting/reporting_delegate_factory_desktop.h",
"feedback/feedback_dialog_utils.cc",