#include "components/sync_sessions/local_session_event_handler_impl.h"
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/timer/elapsed_timer.h"
#include "components/sync/base/features.h"
#include "components/sync/base/time.h"
#include "components/sync/protocol/session_specifics.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_sessions/sync_sessions_client.h"
#include "components/sync_sessions/synced_session_tracker.h"
#include "components/sync_sessions/synced_tab_delegate.h"
#include "components/sync_sessions/synced_window_delegate.h"
#include "components/sync_sessions/synced_window_delegates_getter.h"
namespace sync_sessions {
namespace {
SerializedNavigationEntry;
enum PlaceholderTabResyncResultHistogramValue { … };
const int kMaxSyncNavigationCount = …;
bool IsSessionRestoreInProgress(SyncSessionsClient* sessions_client) { … }
bool IsWindowSyncable(const SyncedWindowDelegate& window_delegate) { … }
bool ScanForTabbedWindow(SyncedWindowDelegatesGetter* delegates_getter) { … }
sync_pb::SyncEnums_BrowserType BrowserTypeFromWindowDelegate(
const SyncedWindowDelegate& delegate) { … }
#if BUILDFLAG(IS_ANDROID)
void RecordPlaceholderTabResyncResult(
PlaceholderTabResyncResultHistogramValue result_value) {
base::UmaHistogramEnumeration("Sync.PlaceholderTabResyncResult",
result_value);
}
#endif
}
LocalSessionEventHandlerImpl::WriteBatch::WriteBatch() = default;
LocalSessionEventHandlerImpl::WriteBatch::~WriteBatch() = default;
LocalSessionEventHandlerImpl::Delegate::~Delegate() = default;
LocalSessionEventHandlerImpl::LocalSessionEventHandlerImpl(
Delegate* delegate,
SyncSessionsClient* sessions_client,
SyncedSessionTracker* session_tracker)
: … { … }
LocalSessionEventHandlerImpl::~LocalSessionEventHandlerImpl() = default;
void LocalSessionEventHandlerImpl::OnSessionRestoreComplete() { … }
sync_pb::SessionTab
LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegateForTest(
SyncedTabDelegate& tab_delegate) const { … }
void LocalSessionEventHandlerImpl::CleanupLocalTabs(WriteBatch* batch) { … }
void LocalSessionEventHandlerImpl::AssociateWindows(ReloadTabsOption option,
WriteBatch* batch,
bool is_session_restore) { … }
void LocalSessionEventHandlerImpl::AssociateTab(
SyncedTabDelegate* const tab_delegate,
WriteBatch* batch) { … }
void LocalSessionEventHandlerImpl::OnLocalTabModified(
SyncedTabDelegate* modified_tab) { … }
sync_pb::SessionTab LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegate(
SyncedTabDelegate& tab_delegate) const { … }
bool LocalSessionEventHandlerImpl::AssociatePlaceholderTab(
std::unique_ptr<SyncedTabDelegate> snapshot,
WriteBatch* batch) { … }
}