#include "components/plus_addresses/settings/plus_address_setting_sync_bridge.h"
#include <memory>
#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "base/sequence_checker.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/model/client_tag_based_data_type_processor.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/model/in_memory_metadata_change_list.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/plus_address_setting_specifics.pb.h"
namespace plus_addresses {
#undef RETURN_IF_ERROR
#define RETURN_IF_ERROR(error) …
namespace {
std::unique_ptr<syncer::EntityData> CreateEntityData(
const sync_pb::PlusAddressSettingSpecifics& specifics) { … }
}
PlusAddressSettingSyncBridge::PlusAddressSettingSyncBridge(
std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor,
syncer::OnceDataTypeStoreFactory store_factory)
: … { … }
PlusAddressSettingSyncBridge::~PlusAddressSettingSyncBridge() = default;
std::unique_ptr<PlusAddressSettingSyncBridge>
PlusAddressSettingSyncBridge::CreateBridge(
syncer::OnceDataTypeStoreFactory store_factory) { … }
std::optional<sync_pb::PlusAddressSettingSpecifics>
PlusAddressSettingSyncBridge::GetSetting(std::string_view name) const { … }
void PlusAddressSettingSyncBridge::WriteSetting(
const sync_pb::PlusAddressSettingSpecifics& specifics) { … }
std::unique_ptr<syncer::MetadataChangeList>
PlusAddressSettingSyncBridge::CreateMetadataChangeList() { … }
std::optional<syncer::ModelError>
PlusAddressSettingSyncBridge::MergeFullSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) { … }
std::optional<syncer::ModelError>
PlusAddressSettingSyncBridge::ApplyIncrementalSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
void PlusAddressSettingSyncBridge::ApplyDisableSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) { … }
std::unique_ptr<syncer::DataBatch>
PlusAddressSettingSyncBridge::GetDataForCommit(StorageKeyList storage_keys) { … }
std::unique_ptr<syncer::DataBatch>
PlusAddressSettingSyncBridge::GetAllDataForDebugging() { … }
bool PlusAddressSettingSyncBridge::IsEntityDataValid(
const syncer::EntityData& entity_data) const { … }
std::string PlusAddressSettingSyncBridge::GetClientTag(
const syncer::EntityData& entity_data) { … }
std::string PlusAddressSettingSyncBridge::GetStorageKey(
const syncer::EntityData& entity_data) { … }
void PlusAddressSettingSyncBridge::OnStoreCreated(
const std::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::DataTypeStore> store) { … }
void PlusAddressSettingSyncBridge::StartSyncingWithDataAndMetadata(
const std::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::DataTypeStore::RecordList> data,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) { … }
void PlusAddressSettingSyncBridge::ReportErrorIfSet(
const std::optional<syncer::ModelError>& error) { … }
}