state.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PROFILE_METRICS_STATE_H_
  5. #define COMPONENTS_PROFILE_METRICS_STATE_H_
  6. namespace profile_metrics {
  7. // State for a profile avatar, documenting what Chrome UI exactly shows.
  8. // These values are persisted to logs. Entries should not be renumbered and
  9. // numeric values should never be reused.
  10. enum class AvatarState {
  11. // All SignedIn* states denote having a primary account (incl. unconsented,
  12. // not necessarily syncing).
  13. kSignedInGaia =
  14. 0, // User has the avatar from GAIA (the default for signed-in users).
  15. kSignedInModern = 1, // User has explicitly selected a modern avatar.
  16. kSignedInOld = 2, // User has explicitly selected an old avatar.
  17. kSignedOutDefault = 3, // Grey silhouette.
  18. kSignedOutModern = 4, // User has explicitly selected a modern avatar.
  19. kSignedOutOld = 5, // User has explicitly selected an old avatar.
  20. kMaxValue = kSignedOutOld
  21. };
  22. // State for a profile name, documenting what Chrome UI exactly shows.
  23. // These values are persisted to logs. Entries should not be renumbered and
  24. // numeric values should never be reused.
  25. enum class NameState {
  26. kGaiaName = 0, // The name of the user from Gaia.
  27. kGaiaAndCustomName = 1, // The name of the user from Gaia and the custom
  28. // local name specified by the user.
  29. kGaiaAndDefaultName = 2, // Chrome shows "Person X" alongside the Gaia name
  30. // because it is needed to resolve ambiguity.
  31. kCustomName = 3, // Only a custom name of the profile specified by the user.
  32. kDefaultName = 4, // Only "Person X" since there's nothing better.
  33. kMaxValue = kDefaultName
  34. };
  35. // Type of the unconsented primary account in a profile.
  36. // These values are persisted to logs. Entries should not be renumbered and
  37. // numeric values should never be reused.
  38. enum class UnconsentedPrimaryAccountType {
  39. kConsumer = 0,
  40. kEnterprise = 1,
  41. kChild = 2,
  42. kSignedOut = 3,
  43. kMaxValue = kSignedOut
  44. };
  45. // Classification of what gaia names appear or appeared in this profile since
  46. // the last time gaia cookies got deleted. Thus, this also includes signed-out
  47. // accounts. In order to protect privacy, only classifies whether multiple
  48. // distinct gaia names appeared in this profile and if so, whether sync is
  49. // enabled for one of them. Furthermore, this classification uses a low-entropy
  50. // hash to detect distinct names. In case of a rare hash collision (less than
  51. // 0.1% of cases), multiple names get recorded as a single name. Entries should
  52. // not be renumbered and numeric values should never be reused.
  53. enum class AllAccountsNames {
  54. kLikelySingleName = 0, // Gets also rare false records due to hash collision.
  55. kMultipleNamesWithoutSync = 1,
  56. kMultipleNamesWithSync = 2,
  57. kMaxValue = kMultipleNamesWithSync
  58. };
  59. // Classification of what account categories out of {consumer, enterprise}
  60. // appear or appeared in this profile since the last time gaia cookies got
  61. // deleted. Thus, this also includes signed-out accounts. If both categories
  62. // appeared, it also distinguishes whether sync is enabled and for which of
  63. // them. Entries should not be renumbered and numeric values should never be
  64. // reused.
  65. enum class AllAccountsCategories {
  66. kSingleCategory = 0,
  67. kBothConsumerAndEnterpriseNoSync = 1,
  68. kBothConsumerAndEnterpriseSyncingConsumer = 2,
  69. kBothConsumerAndEnterpriseSyncingEnterprise = 3,
  70. kMaxValue = kBothConsumerAndEnterpriseSyncingEnterprise
  71. };
  72. // Different types of reporting for profile state. This is used as a histogram
  73. // suffix.
  74. enum class StateSuffix {
  75. kAll, // Recorded for all clients and all their profiles.
  76. kActiveMultiProfile, // Recorded for multi-profile users with >=2 active
  77. // profiles, for all their profiles.
  78. kLatentMultiProfile, // Recorded for multi-profile users with one active
  79. // profile, for all their profiles.
  80. kLatentMultiProfileActive, // Recorded for multi-profile users with one
  81. // active profile, only for the active profile.
  82. kLatentMultiProfileOthers, // Recorded for multi-profile users with one
  83. // active profile, only for the non-active
  84. // profiles.
  85. kSingleProfile, // Recorded for single-profile users for their single
  86. // profile.
  87. kUponDeletion // Recorded whenever a profile gets deleted.
  88. };
  89. // Records the state of profile's avatar.
  90. void LogProfileAvatar(AvatarState avatar_state, StateSuffix suffix);
  91. // Records the state of profile's name.
  92. void LogProfileName(NameState name_state, StateSuffix suffix);
  93. // Records the state of profile's UPA.
  94. void LogProfileAccountType(UnconsentedPrimaryAccountType account_type,
  95. StateSuffix suffix);
  96. // Records the state of profile's sync.
  97. void LogProfileSyncEnabled(bool sync_enabled, StateSuffix suffix);
  98. // Records the days since last use of a profile.
  99. void LogProfileDaysSinceLastUse(int days_since_last_use, StateSuffix suffix);
  100. // Records the context of a profile deletion, whether it is the last profile and
  101. // whether it happens while no browser windows are opened.
  102. void LogProfileDeletionContext(bool is_last_profile, bool no_browser_windows);
  103. // Records the state of account names used in multi-login.
  104. void LogProfileAllAccountsNames(AllAccountsNames names);
  105. // Records the state of account categories used in multi-login.
  106. void LogProfileAllAccountsCategories(AllAccountsCategories categories);
  107. } // namespace profile_metrics
  108. #endif // COMPONENTS_PROFILE_METRICS_STATE_H_