1 // Copyright 2014 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.
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
8 #include "base/time/time.h"
10 namespace signin_metrics
{
12 // Enum for the ways in which primary account detection is done.
13 enum DifferentPrimaryAccounts
{
14 // token and cookie had same primary accounts.
16 // Deprecated. Indicates different primary accounts.
17 UNUSED_ACCOUNTS_DIFFERENT
,
18 // No GAIA cookie present, so the primaries are considered different.
20 // There was at least one cookie and one token, and the primaries differed.
21 COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT
,
22 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS
,
25 // Track all the ways a profile can become signed out as a histogram.
27 // The value used within unit tests
29 // The preference or policy controlling if signin is valid has changed.
30 SIGNOUT_PREF_CHANGED
= 0,
31 // The valid pattern for signing in to the Google service changed.
32 GOOGLE_SERVICE_NAME_PATTERN_CHANGED
,
33 // The preference or policy controlling if signin is valid changed during
34 // the signin process.
35 SIGNIN_PREF_CHANGED_DURING_SIGNIN
,
36 // User clicked to signout from the settings page.
37 USER_CLICKED_SIGNOUT_SETTINGS
,
38 // The signin process was aborted, but signin had succeeded, so signout. This
39 // may be due to a server response, policy definition or user action.
41 // The sync server caused the profile to be signed out.
42 SERVER_FORCED_DISABLE
,
43 // The credentials are being transfered to a new profile, so the old one is
47 // Keep this as the last enum.
48 NUM_PROFILE_SIGNOUT_METRICS
,
51 // Log to UMA histograms and UserCounts stats about a single execution of the
53 // |total_number_accounts| - How many accounts are in the browser for this
55 // |count_added_to_cookie_jar| - How many accounts were in the browser but not
57 // |count_added_to_token| - How may accounts were in the cookie jar but not in
59 // |primary_accounts_same| - False if the primary account for the cookie jar
60 // and the token service were different; else true.
61 // |is_first_reconcile| - True if these stats are from the first execution of
62 // the AccountReconcilor.
63 // |pre_count_gaia_cookies| - How many GAIA cookies were present before
64 // the AccountReconcilor began modifying the state.
65 void LogSigninAccountReconciliation(int total_number_accounts
,
66 int count_added_to_cookie_jar
,
67 int count_added_to_token
,
68 bool primary_accounts_same
,
69 bool is_first_reconcile
,
70 int pre_count_gaia_cookies
);
72 // Track a successful signin.
73 void LogSigninAddAccount();
75 // Track a successful signin of a profile.
76 void LogSigninProfile(bool is_first_run
, base::Time install_date
);
78 // Track a profile signout.
79 void LogSignout(ProfileSignout metric
);
81 // Tracks whether the external connection results were all fetched before
82 // the reconcilor tried to use them with MergeSession.
83 void LogExternalCcResultFetches(bool fetches_completed
);
85 } // namespace signin_metrics
87 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_