Commit 7fee16b3 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[ModelTypeWorker] Make bookmarks metric recording symmetric

This CL adds metric recording for bookmark guid migration also in the
encrypted data branch. This makes the code symmetric and thus easier to
refactor in follow-up CLs.

The metric got introduced recently so it is okay to change it without
renaming (given that custom passphrase users will influence it very
little).

Bug: 1007199
Change-Id: Iecb6276cbe3681b57f39d40ffdf7f27ad4839f0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1818485
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699276}
parent 5ec3f4c0
......@@ -387,10 +387,16 @@ ModelTypeWorker::DecryptionStatus ModelTypeWorker::PopulateUpdateResponseData(
// Legacy clients don't populate the guid field in the BookmarkSpecifics, so
// we use the originator_client_item_id instead, if it is a valid GUID.
// Otherwise, we leave the field empty.
if (model_type == BOOKMARKS && !data->specifics.bookmark().has_guid() &&
base::IsValidGUID(update_entity.originator_client_item_id())) {
data->specifics.mutable_bookmark()->set_guid(
update_entity.originator_client_item_id());
if (model_type == BOOKMARKS) {
if (data->specifics.bookmark().has_guid()) {
LogGUIDSource(BookmarkGUIDSource::kSpecifics);
} else if (base::IsValidGUID(update_entity.originator_client_item_id())) {
data->specifics.mutable_bookmark()->set_guid(
update_entity.originator_client_item_id());
LogGUIDSource(BookmarkGUIDSource::kValidOCII);
} else {
LogGUIDSource(BookmarkGUIDSource::kLeftEmpty);
}
}
response_data->entity = std::move(data);
response_data->encryption_key_name = specifics.encrypted().key_name();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment