| 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. | 13 // Helper method to determine which |DifferentPrimaryAccounts| applies. |
| 14 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, | 14 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, |
| 15 int pre_count_gaia_cookies) { | 15 int pre_count_gaia_cookies) { |
| 16 if (primary_accounts_same) | 16 if (primary_accounts_same) |
| 17 return ACCOUNTS_SAME; | 17 return ACCOUNTS_SAME; |
| 18 if (pre_count_gaia_cookies == 0) | 18 if (pre_count_gaia_cookies == 0) |
| 19 return NO_COOKIE_PRESENT; | 19 return NO_COOKIE_PRESENT; |
| 20 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; | 20 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void LogSigninAccountReconciliation(int total_number_accounts, | 23 void LogSigninAccountReconciliation(int total_number_accounts, |
| 24 int count_added_to_cookie_jar, | 24 int count_added_to_cookie_jar, |
| 25 int count_added_to_token, | 25 int count_removed_from_cookie_jar, |
| 26 bool primary_accounts_same, | 26 bool primary_accounts_same, |
| 27 bool is_first_reconcile, | 27 bool is_first_reconcile, |
| 28 int pre_count_gaia_cookies) { | 28 int pre_count_gaia_cookies) { |
| 29 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", | 29 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", |
| 30 total_number_accounts); | 30 total_number_accounts); |
| 31 // We want to include zeroes in the counts of added accounts to easily | 31 // We want to include zeroes in the counts of added or removed accounts to |
| 32 // capture _relatively_ how often we merge accounts. | 32 // easily capture _relatively_ how often we merge accounts. |
| 33 if (is_first_reconcile) { | 33 if (is_first_reconcile) { |
| 34 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun", | 34 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun", |
| 35 count_added_to_cookie_jar); | 35 count_added_to_cookie_jar); |
| 36 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun", | 36 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.RemovedFromCookieJar.FirstRun", |
| 37 count_added_to_token); | 37 count_removed_from_cookie_jar); |
| 38 UMA_HISTOGRAM_ENUMERATION( | 38 UMA_HISTOGRAM_ENUMERATION( |
| 39 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 39 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 40 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), | 40 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| 41 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); | 41 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
| 42 } else { | 42 } else { |
| 43 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", | 43 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", |
| 44 count_added_to_cookie_jar); | 44 count_added_to_cookie_jar); |
| 45 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun", | 45 UMA_HISTOGRAM_COUNTS_100( |
| 46 count_added_to_token); | 46 "Signin.Reconciler.RemovedFromCookieJar.SubsequentRun", |
| 47 count_removed_from_cookie_jar); |
| 47 UMA_HISTOGRAM_ENUMERATION( | 48 UMA_HISTOGRAM_ENUMERATION( |
| 48 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", | 49 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", |
| 49 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), | 50 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| 50 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); | 51 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 void LogSigninProfile(bool is_first_run, base::Time install_date) { | 55 void LogSigninProfile(bool is_first_run, base::Time install_date) { |
| 55 // Track whether or not the user signed in during the first run of Chrome. | 56 // Track whether or not the user signed in during the first run of Chrome. |
| 56 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); | 57 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 74 UMA_HISTOGRAM_ENUMERATION("Signin.SignoutProfile", metric, | 75 UMA_HISTOGRAM_ENUMERATION("Signin.SignoutProfile", metric, |
| 75 NUM_PROFILE_SIGNOUT_METRICS); | 76 NUM_PROFILE_SIGNOUT_METRICS); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void LogExternalCcResultFetches(bool fetches_completed) { | 79 void LogExternalCcResultFetches(bool fetches_completed) { |
| 79 UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.AllExternalCcResultCompleted", | 80 UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.AllExternalCcResultCompleted", |
| 80 fetches_completed); | 81 fetches_completed); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace signin_metrics | 84 } // namespace signin_metrics |
| OLD | NEW |