Skip to content

Commit

Permalink
Do not send meta info until all platforms support necessary chromium
Browse files Browse the repository at this point in the history
sync protocol like "version" and "UniquePosition", ...etc
  • Loading branch information
darkdh committed Aug 19, 2019
1 parent 8b24310 commit 42c5c31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 35 deletions.
15 changes: 0 additions & 15 deletions chromium_src/components/sync/engine_impl/commit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,10 @@ brave_sync::RecordsListPtr ConvertCommitsToBraveRecords(
metaInfo.value = std::to_string(version);
bookmark->metaInfo.push_back(metaInfo);

metaInfo.key = "mtime";
metaInfo.value = std::to_string(entity.mtime());
bookmark->metaInfo.push_back(metaInfo);

metaInfo.key = "ctime";
metaInfo.value = std::to_string(entity.ctime());
bookmark->metaInfo.push_back(metaInfo);

metaInfo.key = "position_in_parent";
metaInfo.value = std::to_string(entity.position_in_parent());
bookmark->metaInfo.push_back(metaInfo);

if (bm_specifics.has_favicon()) {
std::string icon_base64;
base::Base64Encode(bm_specifics.favicon(), &icon_base64);
metaInfo.key = "icon_data";
metaInfo.value = icon_base64;
bookmark->metaInfo.push_back(metaInfo);
}
record->SetBookmark(std::move(bookmark));
if (!skip_record)
record_list->push_back(std::move(record));
Expand Down
14 changes: 0 additions & 14 deletions chromium_src/components/sync/engine_impl/get_updates_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,11 @@ void ExtractBookmarkMeta(sync_pb::SyncEntity* entity,
sync_pb::MetaInfo* meta_info = bm_specifics->add_meta_info();
meta_info->set_key(metaInfo.key);
meta_info->set_value(std::to_string(version));
} else if (metaInfo.key == "mtime") {
int64_t mtime;
bool result = base::StringToInt64(metaInfo.value, &mtime);
DCHECK(result);
entity->set_mtime(mtime);
} else if (metaInfo.key == "ctime") {
int64_t ctime;
bool result = base::StringToInt64(metaInfo.value, &ctime);
DCHECK(result);
entity->set_ctime(ctime);
} else if (metaInfo.key == "position_in_parent") {
int64_t position_in_parent;
bool result = base::StringToInt64(metaInfo.value, &position_in_parent);
DCHECK(result);
entity->set_position_in_parent(position_in_parent);
} else if (metaInfo.key == "icon_data") {
std::string icon_data_decoded;
base::Base64Decode(metaInfo.value, &icon_data_decoded);
bm_specifics->set_favicon(icon_data_decoded);
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions components/brave_sync/brave_profile_sync_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,7 @@ BraveProfileSyncServiceImpl::BookmarkNodeToSyncBookmark(
AddSyncEntityInfo(bookmark.get(), node, "originator_cache_guid");
AddSyncEntityInfo(bookmark.get(), node, "originator_client_item_id");
AddSyncEntityInfo(bookmark.get(), node, "version");
AddSyncEntityInfo(bookmark.get(), node, "mtime");
AddSyncEntityInfo(bookmark.get(), node, "ctime");
AddSyncEntityInfo(bookmark.get(), node, "position_in_parent");
AddSyncEntityInfo(bookmark.get(), node, "icon_data");

record->SetBookmark(std::move(bookmark));

Expand Down Expand Up @@ -729,10 +726,7 @@ void BraveProfileSyncServiceImpl::LoadSyncEntityInfo(
return;
AddSyncEntityInfo(bookmark, node, "originator_cache_guid");
AddSyncEntityInfo(bookmark, node, "originator_client_item_id");
AddSyncEntityInfo(bookmark, node, "mtime");
AddSyncEntityInfo(bookmark, node, "ctime");
AddSyncEntityInfo(bookmark, node, "position_in_parent");
AddSyncEntityInfo(bookmark, node, "icon_data");
std::string s_version;
// Version needs to be incremented by 1 for legacy sync to emulate
// GetUpdateProcessor behavior
Expand Down
6 changes: 6 additions & 0 deletions components/brave_sync/extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ chrome.braveSync.onSendSyncRecords.addListener(function(category_name, records)
// Fixup ids
for (var i = 0; i < records.length; ++i) {
fixupSyncRecordBrowserToExt(records[i]);
// delete meta info for now until all platforms can support
// "Version" and "UniquePosition" of chromium sync proto
if ('bookmark' in records[i]) {
if ('metaInfo' in records[i].bookmark)
delete records[i].bookmark.metaInfo;
}
}
console.log(`"send-sync-records" category_name=${JSON.stringify(category_name)} records=${JSON.stringify(records)}`);
callbackList["send-sync-records"](null, category_name, records);
Expand Down

0 comments on commit 42c5c31

Please sign in to comment.