Commit b26362a1 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[Profile creation] Expand entry points for adding profiles

This CL expands the Profile.AddNewUser histogram with additional enum
entries: one for the sign-in interception and one for (long-existing)
profile creation from the sync confirmation flow.

Bug: 1076880, 1121944
Change-Id: Ibe8a2e00b26dd12d2db4fa46309588e1cda994c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362852Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Auto-Submit: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801735}
parent dc5e5f36
...@@ -202,9 +202,7 @@ void ProfileMetrics::LogNumberOfProfiles(ProfileAttributesStorage* storage) { ...@@ -202,9 +202,7 @@ void ProfileMetrics::LogNumberOfProfiles(ProfileAttributesStorage* storage) {
} }
void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) {
DCHECK(metric < NUM_PROFILE_ADD_METRICS); base::UmaHistogramEnumeration("Profile.AddNewUser", metric);
base::UmaHistogramEnumeration("Profile.AddNewUser", metric,
NUM_PROFILE_ADD_METRICS);
base::UmaHistogramEnumeration("Profile.NetUserCount", base::UmaHistogramEnumeration("Profile.NetUserCount",
ProfileNetUserCounts::ADD_NEW_USER); ProfileNetUserCounts::ADD_NEW_USER);
} }
......
...@@ -32,15 +32,26 @@ enum GAIAServiceType : int; ...@@ -32,15 +32,26 @@ enum GAIAServiceType : int;
class ProfileMetrics { class ProfileMetrics {
public: public:
// Enum for counting the ways users were added. // Enum for counting the ways users were added.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum ProfileAdd { enum ProfileAdd {
ADD_NEW_USER_ICON = 0, // User adds new user from icon menu // User adds new user from icon menu -- no longer used
ADD_NEW_USER_MENU, // User adds new user from menu bar // ADD_NEW_USER_ICON = 0,
ADD_NEW_USER_DIALOG, // User adds new user from create-profile dialog // User adds new user from menu bar
ADD_NEW_USER_MANAGER, // User adds new user from User Manager ADD_NEW_USER_MENU = 1,
ADD_NEW_USER_LAST_DELETED, // Auto-created after deleting last user // User adds new user from create-profile dialog
NUM_PROFILE_ADD_METRICS ADD_NEW_USER_DIALOG = 2,
// User adds new user from User Manager -- no longer used
// ADD_NEW_USER_MANAGER = 3,
// Auto-created after deleting last user
ADD_NEW_USER_LAST_DELETED = 4,
// Created by the sign-in interception prompt
ADD_NEW_USER_SIGNIN_INTERCEPTION = 5,
// Created during the sync flow (to avoid clash with data in the existing
// profile)
ADD_NEW_USER_SYNC_FLOW = 6,
kMaxValue = ADD_NEW_USER_SYNC_FLOW
}; };
enum ProfileDelete { enum ProfileDelete {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/signin/dice_intercepted_session_startup_helper.h" #include "chrome/browser/signin/dice_intercepted_session_startup_helper.h"
#include "chrome/browser/signin/dice_signed_in_profile_creator.h" #include "chrome/browser/signin/dice_signed_in_profile_creator.h"
#include "chrome/browser/signin/dice_web_signin_interceptor_factory.h" #include "chrome/browser/signin/dice_web_signin_interceptor_factory.h"
...@@ -365,6 +366,8 @@ void DiceWebSigninInterceptor::OnNewSignedInProfileCreated( ...@@ -365,6 +366,8 @@ void DiceWebSigninInterceptor::OnNewSignedInProfileCreated(
base::UmaHistogramTimes( base::UmaHistogramTimes(
"Signin.Intercept.ProfileCreationDuration", "Signin.Intercept.ProfileCreationDuration",
base::TimeTicks::Now() - profile_creation_start_time_); base::TimeTicks::Now() - profile_creation_start_time_);
ProfileMetrics::LogProfileAddNewUser(
ProfileMetrics::ADD_NEW_USER_SIGNIN_INTERCEPTION);
if (!new_profile) { if (!new_profile) {
Reset(); Reset();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chrome/browser/policy/cloud/user_policy_signin_service.h" #include "chrome/browser/policy/cloud/user_policy_signin_service.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
#include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/signin/account_id_from_account_info.h" #include "chrome/browser/signin/account_id_from_account_info.h"
#include "chrome/browser/signin/dice_signed_in_profile_creator.h" #include "chrome/browser/signin/dice_signed_in_profile_creator.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
...@@ -385,6 +386,7 @@ syncer::SyncService* DiceTurnSyncOnHelper::GetSyncService() { ...@@ -385,6 +386,7 @@ syncer::SyncService* DiceTurnSyncOnHelper::GetSyncService() {
void DiceTurnSyncOnHelper::OnNewSignedInProfileCreated(Profile* new_profile) { void DiceTurnSyncOnHelper::OnNewSignedInProfileCreated(Profile* new_profile) {
DCHECK(dice_signed_in_profile_creator_); DCHECK(dice_signed_in_profile_creator_);
dice_signed_in_profile_creator_.reset(); dice_signed_in_profile_creator_.reset();
ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_SYNC_FLOW);
if (!new_profile) { if (!new_profile) {
// TODO(atwilson): On error, unregister the client to release the DMToken // TODO(atwilson): On error, unregister the client to release the DMToken
......
...@@ -58149,11 +58149,13 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf ...@@ -58149,11 +58149,13 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
</enum> </enum>
<enum name="ProfileAddNewUser"> <enum name="ProfileAddNewUser">
<int value="0" label="Add new user from icon menu"/> <int value="0" label="(Deprecated) Add new user from icon menu"/>
<int value="1" label="Add new user from title bar menu"/> <int value="1" label="Add new user from title bar menu"/>
<int value="2" label="Add new user from settings dialog"/> <int value="2" label="Add new user from settings dialog"/>
<int value="3" label="Add new user from the User Manager"/> <int value="3" label="(Deprecated) Add new user from the User Manager"/>
<int value="4" label="Auto-created after deleting last user"/> <int value="4" label="Auto-created after deleting last user"/>
<int value="5" label="Add new user from sign-in interception"/>
<int value="6" label="Add new user from the sync flow (to avoid data clash)"/>
</enum> </enum>
<enum name="ProfileAllAccountsCategories"> <enum name="ProfileAllAccountsCategories">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment