#include "components/sync/service/sync_session_durations_metrics_recorder.h"
#include <string>
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
namespace syncer {
namespace {
base::TimeDelta SubtractInactiveTime(base::TimeDelta total_length,
base::TimeDelta inactive_time) { … }
void LogDuration(const std::string& histogram_suffix,
base::TimeDelta session_length) { … }
}
SyncSessionDurationsMetricsRecorder::SyncSessionDurationsMetricsRecorder(
SyncService* sync_service,
signin::IdentityManager* identity_manager)
: … { … }
SyncSessionDurationsMetricsRecorder::~SyncSessionDurationsMetricsRecorder() { … }
SyncSessionDurationsMetricsRecorder::SigninStatus
SyncSessionDurationsMetricsRecorder::GetSigninStatus() const { … }
bool SyncSessionDurationsMetricsRecorder::IsSyncing() const { … }
void SyncSessionDurationsMetricsRecorder::OnSessionStarted(
base::TimeTicks session_start) { … }
void SyncSessionDurationsMetricsRecorder::OnSessionEnded(
base::TimeDelta session_length) { … }
void SyncSessionDurationsMetricsRecorder::OnAccountsInCookieUpdated(
const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
const GoogleServiceAuthError& error) { … }
void SyncSessionDurationsMetricsRecorder::OnStateChanged(SyncService* sync) { … }
void SyncSessionDurationsMetricsRecorder::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) { … }
void SyncSessionDurationsMetricsRecorder::OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) { … }
void SyncSessionDurationsMetricsRecorder::OnRefreshTokenRemovedForAccount(
const CoreAccountId& account_id) { … }
void SyncSessionDurationsMetricsRecorder::OnRefreshTokensLoaded() { … }
void SyncSessionDurationsMetricsRecorder::
OnErrorStateOfRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info,
const GoogleServiceAuthError& error,
signin_metrics::SourceForRefreshTokenOperation token_operation_source) { … }
bool SyncSessionDurationsMetricsRecorder::ShouldLogUpdate(
FeatureState new_sync_status,
SigninStatus new_signin_status) { … }
void SyncSessionDurationsMetricsRecorder::UpdateSyncAndAccountStatus(
FeatureState new_sync_status,
SigninStatus new_signin_status) { … }
void SyncSessionDurationsMetricsRecorder::HandleSyncAndAccountChange() { … }
constexpr int SyncSessionDurationsMetricsRecorder::GetFeatureStates(
SigninStatus signin_status,
FeatureState sync_status) { … }
void SyncSessionDurationsMetricsRecorder::LogSigninDuration(
base::TimeDelta session_length) { … }
void SyncSessionDurationsMetricsRecorder::LogSyncAndAccountDuration(
base::TimeDelta session_length) { … }
SyncSessionDurationsMetricsRecorder::SigninStatus
SyncSessionDurationsMetricsRecorder::DetermineSigninStatus() const { … }
SyncSessionDurationsMetricsRecorder::FeatureState
SyncSessionDurationsMetricsRecorder::DetermineSyncStatus() const { … }
}