OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/signin/core/browser/signin_metrics.h" | 5 #include "components/signin/core/browser/signin_metrics.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
10 | 10 |
11 namespace signin_metrics { | 11 namespace signin_metrics { |
12 | 12 |
| 13 // Helper method to determine which |DifferentPrimaryAccounts| applies. |
| 14 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, |
| 15 int pre_count_gaia_cookies) { |
| 16 if (primary_accounts_same) |
| 17 return ACCOUNTS_SAME; |
| 18 if (pre_count_gaia_cookies == 0) |
| 19 return NO_COOKIE_PRESENT; |
| 20 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; |
| 21 } |
| 22 |
13 void LogSigninAccountReconciliation(int total_number_accounts, | 23 void LogSigninAccountReconciliation(int total_number_accounts, |
14 int count_added_to_cookie_jar, | 24 int count_added_to_cookie_jar, |
15 int count_added_to_token, | 25 int count_added_to_token, |
16 bool primary_accounts_same, | 26 bool primary_accounts_same, |
17 bool is_first_reconcile) { | 27 bool is_first_reconcile, |
| 28 int pre_count_gaia_cookies) { |
18 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", | 29 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", |
19 total_number_accounts); | 30 total_number_accounts); |
20 // We want to include zeroes in the counts of added accounts to easily | 31 // We want to include zeroes in the counts of added accounts to easily |
21 // capture _relatively_ how often we merge accounts. | 32 // capture _relatively_ how often we merge accounts. |
22 if (is_first_reconcile) { | 33 if (is_first_reconcile) { |
23 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun", | 34 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun", |
24 count_added_to_cookie_jar); | 35 count_added_to_cookie_jar); |
25 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun", | 36 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun", |
26 count_added_to_token); | 37 count_added_to_token); |
27 UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 38 UMA_HISTOGRAM_ENUMERATION( |
28 !primary_accounts_same); | 39 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 40 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| 41 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
29 } else { | 42 } else { |
30 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", | 43 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", |
31 count_added_to_cookie_jar); | 44 count_added_to_cookie_jar); |
32 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun", | 45 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun", |
33 count_added_to_token); | 46 count_added_to_token); |
34 UMA_HISTOGRAM_BOOLEAN( | 47 UMA_HISTOGRAM_ENUMERATION( |
35 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", | 48 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", |
36 !primary_accounts_same); | 49 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| 50 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
37 } | 51 } |
38 } | 52 } |
39 | 53 |
40 void LogSigninAddAccount() { | 54 void LogSigninAddAccount() { |
41 // Account signin may fail for a wide variety of reasons. There is no | 55 // Account signin may fail for a wide variety of reasons. There is no |
42 // explicit false, but one can compare this value with the various UI | 56 // explicit false, but one can compare this value with the various UI |
43 // flows that lead to account sign-in, and deduce that the difference | 57 // flows that lead to account sign-in, and deduce that the difference |
44 // counts the failures. | 58 // counts the failures. |
45 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); | 59 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); |
46 } | 60 } |
47 | 61 |
48 } // namespace signin_metrics | 62 } // namespace signin_metrics |
OLD | NEW |