#include "components/reading_list/core/reading_list_sync_bridge.h"
#include <set>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/clock.h"
#include "base/trace_event/trace_event.h"
#include "components/reading_list/core/reading_list_model_impl.h"
#include "components/sync/base/data_type_histogram.h"
#include "components/sync/base/deletion_origin.h"
#include "components/sync/model/data_type_local_change_processor.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/in_memory_metadata_change_list.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/data_type_state_helper.h"
ReadingListSyncBridge::ReadingListSyncBridge(
syncer::StorageType storage_type,
syncer::WipeModelUponSyncDisabledBehavior
wipe_model_upon_sync_disabled_behavior,
base::Clock* clock,
std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor)
: … { … }
ReadingListSyncBridge::~ReadingListSyncBridge() { … }
void ReadingListSyncBridge::ModelReadyToSync(
ReadingListModelImpl* model,
std::unique_ptr<syncer::MetadataBatch> sync_metadata_batch) { … }
void ReadingListSyncBridge::ReportError(const syncer::ModelError& error) { … }
void ReadingListSyncBridge::DidAddOrUpdateEntry(
const ReadingListEntry& entry,
syncer::MetadataChangeList* metadata_change_list) { … }
void ReadingListSyncBridge::DidRemoveEntry(
const ReadingListEntry& entry,
const base::Location& location,
syncer::MetadataChangeList* metadata_change_list) { … }
bool ReadingListSyncBridge::IsTrackingMetadata() const { … }
syncer::StorageType ReadingListSyncBridge::GetStorageTypeForUma() const { … }
std::unique_ptr<syncer::MetadataChangeList>
ReadingListSyncBridge::CreateMetadataChangeList() { … }
std::optional<syncer::ModelError> ReadingListSyncBridge::MergeFullSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
std::optional<syncer::ModelError>
ReadingListSyncBridge::ApplyIncrementalSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
std::unique_ptr<syncer::DataBatch> ReadingListSyncBridge::GetDataForCommit(
StorageKeyList storage_keys) { … }
std::unique_ptr<syncer::DataBatch>
ReadingListSyncBridge::GetAllDataForDebugging() { … }
void ReadingListSyncBridge::AddEntryToBatch(syncer::MutableDataBatch* batch,
const ReadingListEntry& entry) { … }
std::string ReadingListSyncBridge::GetClientTag(
const syncer::EntityData& entity_data) { … }
std::string ReadingListSyncBridge::GetStorageKey(
const syncer::EntityData& entity_data) { … }
void ReadingListSyncBridge::ApplyDisableSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) { … }
bool ReadingListSyncBridge::IsEntityDataValid(
const syncer::EntityData& entity_data) const { … }
bool ReadingListSyncBridge::CompareEntriesForSync(
const sync_pb::ReadingListSpecifics& lhs,
const sync_pb::ReadingListSpecifics& rhs) { … }