#include "components/sharing_message/sharing_message_bridge_impl.h"
#include "base/metrics/histogram_functions.h"
#include "base/uuid.h"
#include "components/sharing_message/features.h"
#include "components/sync/model/empty_metadata_change_list.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "net/base/network_change_notifier.h"
namespace {
void ReplyToCallback(SharingMessageBridge::CommitFinishedCallback callback,
const sync_pb::SharingMessageCommitError& commit_error) { … }
void ReplyToCallback(
SharingMessageBridge::CommitFinishedCallback callback,
sync_pb::SharingMessageCommitError::ErrorCode commit_error_code) { … }
syncer::ClientTagHash GetClientTagHashFromStorageKey(
const std::string& storage_key) { … }
std::unique_ptr<syncer::EntityData> MoveToEntityData(
std::unique_ptr<sync_pb::SharingMessageSpecifics> specifics) { … }
std::unique_ptr<syncer::EntityData> CopyToEntityData(
const sync_pb::SharingMessageSpecifics& specifics) { … }
}
SharingMessageBridgeImpl::SharingMessageBridgeImpl(
std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor)
: … { … }
SharingMessageBridgeImpl::~SharingMessageBridgeImpl() = default;
void SharingMessageBridgeImpl::SendSharingMessage(
std::unique_ptr<sync_pb::SharingMessageSpecifics> specifics,
CommitFinishedCallback on_commit_callback) { … }
base::WeakPtr<syncer::DataTypeControllerDelegate>
SharingMessageBridgeImpl::GetControllerDelegate() { … }
std::unique_ptr<syncer::MetadataChangeList>
SharingMessageBridgeImpl::CreateMetadataChangeList() { … }
std::optional<syncer::ModelError> SharingMessageBridgeImpl::MergeFullSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) { … }
std::optional<syncer::ModelError>
SharingMessageBridgeImpl::ApplyIncrementalSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
std::unique_ptr<syncer::DataBatch> SharingMessageBridgeImpl::GetDataForCommit(
StorageKeyList storage_keys) { … }
std::unique_ptr<syncer::DataBatch>
SharingMessageBridgeImpl::GetAllDataForDebugging() { … }
std::string SharingMessageBridgeImpl::GetClientTag(
const syncer::EntityData& entity_data) { … }
std::string SharingMessageBridgeImpl::GetStorageKey(
const syncer::EntityData& entity_data) { … }
void SharingMessageBridgeImpl::OnCommitAttemptErrors(
const syncer::FailedCommitResponseDataList& error_response_list) { … }
syncer::DataTypeSyncBridge::CommitAttemptFailedBehavior
SharingMessageBridgeImpl::OnCommitAttemptFailed(
syncer::SyncCommitError commit_error) { … }
void SharingMessageBridgeImpl::ApplyDisableSyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list) { … }
void SharingMessageBridgeImpl::OnSyncPaused() { … }
void SharingMessageBridgeImpl::ProcessCommitTimeout(
const syncer::ClientTagHash& client_tag_hash) { … }
void SharingMessageBridgeImpl::ProcessCommitResponse(
const syncer::ClientTagHash& client_tag_hash,
const sync_pb::SharingMessageCommitError& commit_error_message) { … }
SharingMessageBridgeImpl::TimedCallback::TimedCallback(
CommitFinishedCallback commit_callback,
base::OnceClosure timeout_callback)
: … { … }
SharingMessageBridgeImpl::TimedCallback::~TimedCallback() = default;
void SharingMessageBridgeImpl::TimedCallback::Run(
const sync_pb::SharingMessageCommitError& commit_error) { … }
SharingMessageBridgeImpl::PendingCommit::PendingCommit(
std::unique_ptr<TimedCallback> timed_callback,
sync_pb::SharingMessageSpecifics specifics)
: … { … }
SharingMessageBridgeImpl::PendingCommit::~PendingCommit() = default;
SharingMessageBridgeImpl::PendingCommit::PendingCommit(PendingCommit&&) =
default;
SharingMessageBridgeImpl::PendingCommit&
SharingMessageBridgeImpl::PendingCommit::operator=(PendingCommit&&) = default;