#include "components/sharing_message/sharing_device_source_sync.h"
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "base/functional/callback.h"
#include "base/stl_util.h"
#include "base/task/thread_pool.h"
#include "base/trace_event/trace_event.h"
#include "components/send_tab_to_self/target_device_info.h"
#include "components/sharing_message/features.h"
#include "components/sharing_message/proto/sharing_message.pb.h"
#include "components/sharing_message/sharing_constants.h"
#include "components/sharing_message/sharing_target_device_info.h"
#include "components/sharing_message/sharing_utils.h"
#include "components/sync/service/sync_service.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/local_device_info_provider.h"
#include "components/sync_device_info/local_device_info_util.h"
SharingSpecificFields;
namespace {
bool IsStale(const syncer::DeviceInfo& device) { … }
SharingTargetDeviceInfo ConvertDeviceInfo(const syncer::DeviceInfo* device,
bool use_short_name) { … }
}
SharingDeviceSourceSync::SharingDeviceSourceSync(
syncer::SyncService* sync_service,
syncer::LocalDeviceInfoProvider* local_device_info_provider,
syncer::DeviceInfoTracker* device_info_tracker)
: … { … }
SharingDeviceSourceSync::~SharingDeviceSourceSync() { … }
std::optional<SharingTargetDeviceInfo> SharingDeviceSourceSync::GetDeviceByGuid(
const std::string& guid) { … }
std::vector<SharingTargetDeviceInfo>
SharingDeviceSourceSync::GetDeviceCandidates(
SharingSpecificFields::EnabledFeatures required_feature) { … }
bool SharingDeviceSourceSync::IsReady() { … }
void SharingDeviceSourceSync::OnDeviceInfoChange() { … }
void SharingDeviceSourceSync::SetDeviceInfoTrackerForTesting(
syncer::DeviceInfoTracker* tracker) { … }
void SharingDeviceSourceSync::InitPersonalizableLocalDeviceName(
std::string personalizable_local_device_name) { … }
void SharingDeviceSourceSync::OnLocalDeviceInfoProviderReady() { … }
std::vector<const syncer::DeviceInfo*>
SharingDeviceSourceSync::FilterDeviceCandidates(
std::vector<const syncer::DeviceInfo*> devices,
sync_pb::SharingSpecificFields::EnabledFeatures required_feature) const { … }
std::vector<SharingTargetDeviceInfo>
SharingDeviceSourceSync::ConvertAndDeduplicateDevices(
std::vector<const syncer::DeviceInfo*> devices) const { … }