#include "components/sync_sessions/session_sync_bridge.h"
#include <stdint.h>
#include <algorithm>
#include <set>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/base/deletion_origin.h"
#include "components/sync/base/time.h"
#include "components/sync/model/data_type_activation_request.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/session_specifics.pb.h"
#include "components/sync_sessions/session_sync_prefs.h"
#include "components/sync_sessions/sync_sessions_client.h"
#include "components/sync_sessions/synced_window_delegate.h"
#include "components/sync_sessions/synced_window_delegates_getter.h"
namespace sync_sessions {
namespace {
SessionSpecifics;
MetadataChangeList;
const base::TimeDelta kStaleSessionThreshold = …;
std::unique_ptr<syncer::EntityData> MoveToEntityData(
const std::string& client_name,
SessionSpecifics* specifics) { … }
class LocalSessionWriteBatch : public LocalSessionEventHandlerImpl::WriteBatch { … };
}
SessionSyncBridge::SessionSyncBridge(
const base::RepeatingClosure& notify_foreign_session_updated_cb,
SyncSessionsClient* sessions_client,
std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor)
: … { … }
SessionSyncBridge::~SessionSyncBridge() { … }
SessionsGlobalIdMapper* SessionSyncBridge::GetGlobalIdMapper() { … }
OpenTabsUIDelegate* SessionSyncBridge::GetOpenTabsUIDelegate() { … }
bool SessionSyncBridge::IsLocalDataOutOfSyncForTest() const { … }
std::unique_ptr<MetadataChangeList>
SessionSyncBridge::CreateMetadataChangeList() { … }
std::optional<syncer::ModelError> SessionSyncBridge::MergeFullSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) { … }
void SessionSyncBridge::StartLocalSessionEventHandler() { … }
std::optional<syncer::ModelError>
SessionSyncBridge::ApplyIncrementalSyncChanges(
std::unique_ptr<MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) { … }
std::unique_ptr<syncer::DataBatch> SessionSyncBridge::GetDataForCommit(
StorageKeyList storage_keys) { … }
std::unique_ptr<syncer::DataBatch> SessionSyncBridge::GetAllDataForDebugging() { … }
std::string SessionSyncBridge::GetClientTag(
const syncer::EntityData& entity_data) { … }
std::string SessionSyncBridge::GetStorageKey(
const syncer::EntityData& entity_data) { … }
bool SessionSyncBridge::IsEntityDataValid(
const syncer::EntityData& entity_data) const { … }
void SessionSyncBridge::ApplyDisableSyncChanges(
std::unique_ptr<MetadataChangeList> delete_metadata_change_list) { … }
void SessionSyncBridge::OnSyncPaused() { … }
std::unique_ptr<LocalSessionEventHandlerImpl::WriteBatch>
SessionSyncBridge::CreateLocalSessionWriteBatch() { … }
bool SessionSyncBridge::IsTabNodeUnsynced(int tab_node_id) { … }
void SessionSyncBridge::TrackLocalNavigationId(base::Time timestamp,
int unique_id) { … }
void SessionSyncBridge::OnSyncStarting(
const syncer::DataTypeActivationRequest& request) { … }
void SessionSyncBridge::OnStoreInitialized(
const std::optional<syncer::ModelError>& error,
std::unique_ptr<SessionStore> store,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) { … }
void SessionSyncBridge::DeleteForeignSessionFromUI(const std::string& tag) { … }
void SessionSyncBridge::DoGarbageCollection(SessionStore::WriteBatch* batch) { … }
void SessionSyncBridge::DeleteForeignSessionWithBatch(
const std::string& session_tag,
SessionStore::WriteBatch* batch) { … }
std::unique_ptr<SessionStore::WriteBatch>
SessionSyncBridge::CreateSessionStoreWriteBatch() { … }
void SessionSyncBridge::ResubmitLocalSession() { … }
void SessionSyncBridge::ReportError(const syncer::ModelError& error) { … }
SessionSyncBridge::SyncingState::SyncingState() = default;
SessionSyncBridge::SyncingState::~SyncingState() = default;
}