#include "components/saved_tab_groups/tab_group_sync_metrics_logger.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "components/saved_tab_groups/saved_tab_group.h"
#include "components/saved_tab_groups/saved_tab_group_tab.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/device_info_tracker.h"
namespace tab_groups {
namespace {
constexpr base::TimeDelta kOneDay = …;
constexpr base::TimeDelta kSevenDays = …;
constexpr base::TimeDelta kTwentyEightDays = …;
void LogGroupCreated(DeviceType group_create_origin) { … }
void LogGroupRemoved(DeviceType group_create_origin) { … }
void LogGroupOpened(DeviceType group_create_origin,
const SavedTabGroup* group,
OpeningSource opening_source) { … }
void LogGroupClosed(DeviceType group_create_origin,
const SavedTabGroup* group,
ClosingSource closing_source) { … }
void LogGroupVisualsChanged(DeviceType group_create_origin) { … }
void LogGroupTabsReordered(DeviceType group_create_origin) { … }
void LogTabAdded(DeviceType group_create_origin) { … }
void LogTabNavigated(DeviceType group_create_origin,
DeviceType tab_create_origin) { … }
void LogTabRemoved(DeviceType group_create_origin,
DeviceType tab_create_origin) { … }
void LogTabSelected(DeviceType group_create_origin,
DeviceType tab_create_origin,
const SavedTabGroup* group,
const SavedTabGroupTab* tab) { … }
void LogTabGroupUserInteracted(DeviceType group_create_origin,
const SavedTabGroup* group) { … }
}
TabGroupSyncMetricsLogger::TabGroupSyncMetricsLogger(
syncer::DeviceInfoTracker* device_info_tracker)
: … { … }
TabGroupSyncMetricsLogger::~TabGroupSyncMetricsLogger() = default;
void TabGroupSyncMetricsLogger::LogEvent(const EventDetails& event_details,
const SavedTabGroup* group,
const SavedTabGroupTab* tab) { … }
DeviceType TabGroupSyncMetricsLogger::GetDeviceTypeFromCacheGuid(
const std::optional<std::string>& cache_guid) const { … }
DeviceType TabGroupSyncMetricsLogger::GetDeviceTypeFromDeviceInfo(
const syncer::DeviceInfo& device_info) const { … }
void TabGroupSyncMetricsLogger::RecordMetricsOnStartup(
const std::vector<SavedTabGroup>& saved_tab_groups,
const std::vector<bool>& is_remote) { … }
}