Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / signin / core / browser / signin_metrics.h
blobaa043c25c3e2b3beafb071880f71282bd75ad6e3
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 #include "google_apis/gaia/google_service_auth_error.h"
12 namespace signin_metrics {
14 // Enum for the ways in which primary account detection is done.
15 enum DifferentPrimaryAccounts {
16 // token and cookie had same primary accounts.
17 ACCOUNTS_SAME = 0,
18 // Deprecated. Indicates different primary accounts.
19 UNUSED_ACCOUNTS_DIFFERENT,
20 // No GAIA cookie present, so the primaries are considered different.
21 NO_COOKIE_PRESENT,
22 // There was at least one cookie and one token, and the primaries differed.
23 COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT,
24 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS,
27 // Track all the ways a profile can become signed out as a histogram.
28 enum ProfileSignout {
29 // The value used within unit tests
30 SIGNOUT_TEST = 0,
31 // The preference or policy controlling if signin is valid has changed.
32 SIGNOUT_PREF_CHANGED = 0,
33 // The valid pattern for signing in to the Google service changed.
34 GOOGLE_SERVICE_NAME_PATTERN_CHANGED,
35 // The preference or policy controlling if signin is valid changed during
36 // the signin process.
37 SIGNIN_PREF_CHANGED_DURING_SIGNIN,
38 // User clicked to signout from the settings page.
39 USER_CLICKED_SIGNOUT_SETTINGS,
40 // The signin process was aborted, but signin had succeeded, so signout. This
41 // may be due to a server response, policy definition or user action.
42 ABORT_SIGNIN,
43 // The sync server caused the profile to be signed out.
44 SERVER_FORCED_DISABLE,
45 // The credentials are being transfered to a new profile, so the old one is
46 // signed out.
47 TRANSFER_CREDENTIALS,
49 // Keep this as the last enum.
50 NUM_PROFILE_SIGNOUT_METRICS,
53 // Enum values used for use with "AutoLogin.Reverse" histograms.
54 enum {
55 // The infobar was shown to the user.
56 HISTOGRAM_SHOWN,
57 // The user pressed the accept button to perform the suggested action.
58 HISTOGRAM_ACCEPTED,
59 // The user pressed the reject to turn off the feature.
60 HISTOGRAM_REJECTED,
61 // The user pressed the X button to dismiss the infobar this time.
62 HISTOGRAM_DISMISSED,
63 // The user completely ignored the infoar. Either they navigated away, or
64 // they used the page as is.
65 HISTOGRAM_IGNORED,
66 // The user clicked on the learn more link in the infobar.
67 HISTOGRAM_LEARN_MORE,
68 // The sync was started with default settings.
69 HISTOGRAM_WITH_DEFAULTS,
70 // The sync was started with advanced settings.
71 HISTOGRAM_WITH_ADVANCED,
72 // The sync was started through auto-accept with default settings.
73 HISTOGRAM_AUTO_WITH_DEFAULTS,
74 // The sync was started through auto-accept with advanced settings.
75 HISTOGRAM_AUTO_WITH_ADVANCED,
76 // The sync was aborted with an undo button.
77 HISTOGRAM_UNDO,
78 HISTOGRAM_MAX
81 // Enum values used with the "Signin.OneClickConfirmation" histogram, which
82 // tracks the actions used in the OneClickConfirmation bubble.
83 enum {
84 HISTOGRAM_CONFIRM_SHOWN,
85 HISTOGRAM_CONFIRM_OK,
86 HISTOGRAM_CONFIRM_RETURN,
87 HISTOGRAM_CONFIRM_ADVANCED,
88 HISTOGRAM_CONFIRM_CLOSE,
89 HISTOGRAM_CONFIRM_ESCAPE,
90 HISTOGRAM_CONFIRM_UNDO,
91 HISTOGRAM_CONFIRM_LEARN_MORE,
92 HISTOGRAM_CONFIRM_LEARN_MORE_OK,
93 HISTOGRAM_CONFIRM_LEARN_MORE_RETURN,
94 HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED,
95 HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE,
96 HISTOGRAM_CONFIRM_LEARN_MORE_ESCAPE,
97 HISTOGRAM_CONFIRM_LEARN_MORE_UNDO,
98 HISTOGRAM_CONFIRM_MAX
101 // Enum valus used with the "Signin.SigninSource" histogram, which tracks the
102 // source that launched a Gaia signin page.
103 enum Source {
104 SOURCE_START_PAGE = 0, // This must be first.
105 SOURCE_NTP_LINK,
106 SOURCE_MENU,
107 SOURCE_SETTINGS,
108 SOURCE_EXTENSION_INSTALL_BUBBLE,
109 SOURCE_APP_LAUNCHER,
110 SOURCE_APPS_PAGE_LINK,
111 SOURCE_BOOKMARK_BUBBLE,
112 SOURCE_AVATAR_BUBBLE_SIGN_IN,
113 SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT,
114 SOURCE_DEVICES_PAGE,
115 SOURCE_REAUTH,
116 SOURCE_UNKNOWN, // This must be last.
119 // Enum values used for use with the "Signin.Reauth" histogram.
120 enum AccountReauth {
121 // The user gave the wrong email when doing a reauthentication.
122 HISTOGRAM_ACCOUNT_MISSMATCH,
123 // The user was shown a reauthentication login screen.
124 HISTOGRAM_REAUTH_SHOWN,
126 HISTOGRAM_REAUTH_MAX
129 // Log to UMA histograms and UserCounts stats about a single execution of the
130 // AccountReconciler.
131 // |total_number_accounts| - How many accounts are in the browser for this
132 // profile.
133 // |count_added_to_cookie_jar| - How many accounts were in the browser but not
134 // in the cookie jar.
135 // |count_removed_from_cookie_jar| - How many accounts were in the cookie jar
136 // but not in the browser.
137 // |primary_accounts_same| - False if the primary account for the cookie jar
138 // and the token service were different; else true.
139 // |is_first_reconcile| - True if these stats are from the first execution of
140 // the AccountReconcilor.
141 // |pre_count_gaia_cookies| - How many GAIA cookies were present before
142 // the AccountReconcilor began modifying the state.
143 void LogSigninAccountReconciliation(int total_number_accounts,
144 int count_added_to_cookie_jar,
145 int count_removed_from_cookie_jar,
146 bool primary_accounts_same,
147 bool is_first_reconcile,
148 int pre_count_gaia_cookies);
150 // Track a successful signin.
151 void LogSigninAddAccount();
153 // Tracks the original source that showed the signin page.
154 void LogSigninSource(Source source);
156 // Track a successful signin of a profile.
157 void LogSigninProfile(bool is_first_run, base::Time install_date);
159 // Track a profile signout.
160 void LogSignout(ProfileSignout metric);
162 // Tracks whether the external connection results were all fetched before
163 // the gaia cookie manager service tried to use them with merge session.
164 // |time_to_check_connections| is the time it took to complete.
165 void LogExternalCcResultFetches(
166 bool fetches_completed,
167 const base::TimeDelta& time_to_check_connections);
169 // Track when the current authentication error changed.
170 void LogAuthError(GoogleServiceAuthError::State auth_error);
172 void LogSigninConfirmHistogramValue(int action);
174 } // namespace signin_metrics
176 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_