Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / components / signin / core / browser / signin_metrics.h
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.
4
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
7
8 #include "base/time/time.h"
9
10 namespace signin_metrics {
11
12 // Enum for the ways in which primary account detection is done.
13 enum DifferentPrimaryAccounts {
14   // token and cookie had same primary accounts.
15   ACCOUNTS_SAME = 0,
16   // Deprecated. Indicates different primary accounts.
17   UNUSED_ACCOUNTS_DIFFERENT,
18   // No GAIA cookie present, so the primaries are considered different.
19   NO_COOKIE_PRESENT,
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,
23 };
24
25 // Track all the ways a profile can become signed out as a histogram.
26 enum ProfileSignout {
27   // The value used within unit tests
28   SIGNOUT_TEST = 0,
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.
40   ABORT_SIGNIN,
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
44   // signed out.
45   TRANSFER_CREDENTIALS,
46
47   // Keep this as the last enum.
48   NUM_PROFILE_SIGNOUT_METRICS,
49 };
50
51 // Log to UMA histograms and UserCounts stats about a single execution of the
52 // AccountReconciler.
53 // |total_number_accounts| - How many accounts are in the browser for this
54 //                           profile.
55 // |count_added_to_cookie_jar| - How many accounts were in the browser but not
56 //                               in the cookie jar.
57 // |count_removed_from_cookie_jar| - How many accounts were in the cookie jar
58 //                                   but not in the browser.
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_removed_from_cookie_jar,
68                                     bool primary_accounts_same,
69                                     bool is_first_reconcile,
70                                     int pre_count_gaia_cookies);
71
72 // Track a successful signin.
73 void LogSigninAddAccount();
74
75 // Track a successful signin of a profile.
76 void LogSigninProfile(bool is_first_run, base::Time install_date);
77
78 // Track a profile signout.
79 void LogSignout(ProfileSignout metric);
80
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);
84
85 }  // namespace signin_metrics
86
87 #endif  // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_