chromium/components/profile_metrics/state.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PROFILE_METRICS_STATE_H_
#define COMPONENTS_PROFILE_METRICS_STATE_H_

namespace profile_metrics {

// Type of the unconsented primary account in a profile.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class UnconsentedPrimaryAccountType {};

// Classification of what gaia names appear or appeared in this profile since
// the last time gaia cookies got deleted. Thus, this also includes signed-out
// accounts. In order to protect privacy, only classifies whether multiple
// distinct gaia names appeared in this profile and if so, whether sync is
// enabled for one of them. Furthermore, this classification uses a low-entropy
// hash to detect distinct names. In case of a rare hash collision (less than
// 0.1% of cases), multiple names get recorded as a single name. Entries should
// not be renumbered and numeric values should never be reused.
enum class AllAccountsNames {};

// Different types of reporting for profile state. This is used as a histogram
// suffix.
enum class StateSuffix {};

// Records the state of profile's UPA.
void LogProfileAccountType(UnconsentedPrimaryAccountType account_type,
                           StateSuffix suffix);

// Records the state of profile's sync.
void LogProfileSyncEnabled(bool sync_enabled, StateSuffix suffix);

// Records the days since last use of a profile.
void LogProfileDaysSinceLastUse(int days_since_last_use, StateSuffix suffix);

// Records the context of a profile deletion, whether it is the last profile and
// whether it happens while no browser windows are opened.
void LogProfileDeletionContext(bool is_last_profile, bool no_browser_windows);

// Records the state of account names used in multi-login.
void LogProfileAllAccountsNames(AllAccountsNames names);

}  // namespace profile_metrics

#endif  // COMPONENTS_PROFILE_METRICS_STATE_H_