Chromium Code Reviews| Index: components/signin/core/browser/signin_metrics.cc |
| diff --git a/components/signin/core/browser/signin_metrics.cc b/components/signin/core/browser/signin_metrics.cc |
| index 3cddfdfadbbd041fd513810b050b8e3413f27db7..2f0b355a425aaa5062736edcafc9706c710dcdf1 100644 |
| --- a/components/signin/core/browser/signin_metrics.cc |
| +++ b/components/signin/core/browser/signin_metrics.cc |
| @@ -10,11 +10,35 @@ |
| namespace signin_metrics { |
| +// Enum for the ways in which primary account detection is done. |
| +enum DifferentPrimaryAccounts { |
| + // token and cookie had same primary accounts. |
| + ACCOUNTS_SAME = 0, |
| + // Deprecated. Indicates different primary accounts. |
| + UNUSED_ACCOUNTS_DIFFERENT, |
| + // No GAIA cookie present, so the primaries are considered different. |
| + NO_COOKIE_PRESENT, |
| + // There was at least one cookie and one token, and the primaries differed. |
| + COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT, |
| + NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS, |
| +}; |
| + |
| +// Helper method to determine which |DifferentPrimaryAccounts| applies. |
| +DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, |
| + int pre_count_gaia_cookies) { |
|
Alexei Svitkine (slow)
2014/06/17 19:43:04
Nit: Align or if it doesn't fit, wrap both params.
|
| + if (primary_accounts_same) |
| + return ACCOUNTS_SAME; |
| + if (pre_count_gaia_cookies == 0) |
| + return NO_COOKIE_PRESENT; |
| + return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; |
| +} |
| + |
| void LogSigninAccountReconciliation(int total_number_accounts, |
| int count_added_to_cookie_jar, |
| int count_added_to_token, |
| bool primary_accounts_same, |
| - bool is_first_reconcile) { |
| + bool is_first_reconcile, |
| + int pre_count_gaia_cookies) { |
| UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", |
| total_number_accounts); |
| // We want to include zeroes in the counts of added accounts to easily |
| @@ -24,16 +48,19 @@ void LogSigninAccountReconciliation(int total_number_accounts, |
| count_added_to_cookie_jar); |
| UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun", |
| count_added_to_token); |
| - UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| - !primary_accounts_same); |
| + UMA_HISTOGRAM_ENUMERATION( |
| + "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| + ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| + NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
| } else { |
| UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", |
| count_added_to_cookie_jar); |
| UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun", |
| count_added_to_token); |
| - UMA_HISTOGRAM_BOOLEAN( |
| + UMA_HISTOGRAM_ENUMERATION( |
| "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", |
| - !primary_accounts_same); |
| + ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies), |
| + NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS); |
| } |
| } |