#include "chrome/browser/security_events/security_event_sync_bridge_impl.h"
#include <array>
#include <memory>
#include <set>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/numerics/byte_conversions.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/security_event_specifics.pb.h"
namespace {
std::string GetStorageKeyFromSpecifics(
const sync_pb::SecurityEventSpecifics& specifics) { … }
std::unique_ptr<syncer::EntityData> ToEntityData(
sync_pb::SecurityEventSpecifics specifics) { … }
}
SecurityEventSyncBridgeImpl::SecurityEventSyncBridgeImpl(
syncer::OnceDataTypeStoreFactory store_factory,
std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor)
: … { … }
SecurityEventSyncBridgeImpl::~SecurityEventSyncBridgeImpl() { … }
void SecurityEventSyncBridgeImpl::RecordSecurityEvent(
sync_pb::SecurityEventSpecifics specifics) { … }
base::WeakPtr<syncer::DataTypeControllerDelegate>
SecurityEventSyncBridgeImpl::GetControllerDelegate() { … }
std::unique_ptr<syncer::MetadataChangeList>
SecurityEventSyncBridgeImpl::CreateMetadataChangeList() { … }
std::optional<syncer::ModelError>
SecurityEventSyncBridgeImpl::MergeFullSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) { … }
std::optional<syncer::ModelError>
SecurityEventSyncBridgeImpl::ApplyIncrementalSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
std::unique_ptr<syncer::DataBatch>
SecurityEventSyncBridgeImpl::GetDataForCommit(StorageKeyList storage_keys) { … }
std::unique_ptr<syncer::DataBatch>
SecurityEventSyncBridgeImpl::GetAllDataForDebugging() { … }
std::string SecurityEventSyncBridgeImpl::GetClientTag(
const syncer::EntityData& entity_data) { … }
std::string SecurityEventSyncBridgeImpl::GetStorageKey(
const syncer::EntityData& entity_data) { … }
void SecurityEventSyncBridgeImpl::ApplyDisableSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) { … }
void SecurityEventSyncBridgeImpl::OnStoreLoaded(
const std::optional<syncer::ModelError>& error,
std::unique_ptr<StoreWithCache> store,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) { … }
void SecurityEventSyncBridgeImpl::OnStoreCommit(
const std::optional<syncer::ModelError>& error) { … }