Raise `local copy` flag in LOG_UPLOAD events
Automatically set `needs_local_unencrypted_copy` flag in LOG_UPLOAD
events.
Bug: b:264399295
Change-Id: I5ca899a2a54c2119f4e6398b2a4b1e0c61dd0ae0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4292195
Auto-Submit: Leonid Baraz <[email protected]>
Commit-Queue: Leonid Baraz <[email protected]>
Reviewed-by: Vignesh Shenvi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1109839}
diff --git a/components/reporting/client/report_queue_impl.cc b/components/reporting/client/report_queue_impl.cc
index 1292e11..5064095 100644
--- a/components/reporting/client/report_queue_impl.cc
+++ b/components/reporting/client/report_queue_impl.cc
@@ -63,6 +63,20 @@
record.set_reserved_space(reserved_space);
}
+ // Additional record augmentation for keeping local record copy.
+ // Note: that must be done before calling `storage->AddRecord` below,
+ // because later the handler might call it with no need to set this flag.
+ switch (destination) {
+ case LOG_UPLOAD:
+ // It would be better to base the decision on `upload_settings` presence
+ // in the event, but that would require protobuf reflecion, that is not
+ // included in Chromium build. So instead we just use `destination`.
+ record.set_needs_local_unencrypted_copy(true);
+ break;
+ default: // Do nothing.
+ break;
+ }
+
// |record| with no DM token is assumed to be associated with device DM token
if (!dm_token.empty()) {
*record.mutable_dm_token() = std::move(dm_token);