File: state.h

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (77 lines) | stat: -rw-r--r-- 3,442 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 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 {
  kConsumer = 0,
  kEnterprise = 1,
  kChild = 2,
  kSignedOut = 3,
  kMaxValue = kSignedOut
};

// 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 {
  kLikelySingleName = 0,  // Gets also rare false records due to hash collision.
  kMultipleNamesWithoutSync = 1,
  kMultipleNamesWithSync = 2,
  kMaxValue = kMultipleNamesWithSync
};

// Different types of reporting for profile state. This is used as a histogram
// suffix.
enum class StateSuffix {
  kAll,                 // Recorded for all clients and all their profiles.
  kAllManagedDevice,    // Recorded for all clients on a managed device and all
                        // their profiles.
  kAllUnmanagedDevice,  // Recorded for all clients on an unmanaged device and
                        // all their profiles.
  kActiveMultiProfile,  // Recorded for multi-profile users with >=2 active
                        // profiles, for all their profiles.
  kLatentMultiProfile,  // Recorded for multi-profile users with one active
                        // profile, for all their profiles.
  kLatentMultiProfileActive,  // Recorded for multi-profile users with one
                              // active profile, only for the active profile.
  kLatentMultiProfileOthers,  // Recorded for multi-profile users with one
                              // active profile, only for the non-active
                              // profiles.
  kSingleProfile,  // Recorded for single-profile users for their single
                   // profile.
  kUponDeletion,   // Recorded whenever a profile gets deleted.
};

// 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_