Commit 5732192b authored by Jan Krcal's avatar Jan Krcal Committed by Chromium LUCI CQ

[Profile creation] Record sign-in promo impression

This CL adds a user action for the impression of the sign-in promo which
is part of the new profile creation flow.

Bug: 1126913
Change-Id: Ia10c218ea298858947dc8f41da667f801ca5055e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610097Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842255}
parent b96b4327
...@@ -129,6 +129,9 @@ export class ManageProfilesBrowserProxy { ...@@ -129,6 +129,9 @@ export class ManageProfilesBrowserProxy {
* @param {string} profileName * @param {string} profileName
*/ */
setProfileName(profilePath, profileName) {} setProfileName(profilePath, profileName) {}
/** Records impression of a sign-in promo to metrics. */
recordSignInPromoImpression() {}
} }
/** @implements {ManageProfilesBrowserProxy} */ /** @implements {ManageProfilesBrowserProxy} */
...@@ -195,6 +198,11 @@ export class ManageProfilesBrowserProxyImpl { ...@@ -195,6 +198,11 @@ export class ManageProfilesBrowserProxyImpl {
setProfileName(profilePath, profileName) { setProfileName(profilePath, profileName) {
chrome.send('setProfileName', [profilePath, profileName]); chrome.send('setProfileName', [profilePath, profileName]);
} }
/** @override */
recordSignInPromoImpression() {
chrome.send('recordSignInPromoImpression');
}
} }
addSingletonGetter(ManageProfilesBrowserProxyImpl); addSingletonGetter(ManageProfilesBrowserProxyImpl);
...@@ -11,7 +11,7 @@ import {FocusOutlineManager} from 'chrome://resources/js/cr/ui/focus_outline_man ...@@ -11,7 +11,7 @@ import {FocusOutlineManager} from 'chrome://resources/js/cr/ui/focus_outline_man
import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {AutogeneratedThemeColorInfo} from '../manage_profiles_browser_proxy.js'; import {AutogeneratedThemeColorInfo, ManageProfilesBrowserProxyImpl} from '../manage_profiles_browser_proxy.js';
import {navigateToPreviousRoute, navigateToStep, ProfileCreationSteps, Routes} from '../navigation_behavior.js'; import {navigateToPreviousRoute, navigateToStep, ProfileCreationSteps, Routes} from '../navigation_behavior.js';
Polymer({ Polymer({
...@@ -43,6 +43,7 @@ Polymer({ ...@@ -43,6 +43,7 @@ Polymer({
'load-signin-finished', 'load-signin-finished',
success => this.handleLoadSigninFinished_(success)); success => this.handleLoadSigninFinished_(success));
FocusOutlineManager.forDocument(document); FocusOutlineManager.forDocument(document);
ManageProfilesBrowserProxyImpl.getInstance().recordSignInPromoImpression();
}, },
/** @private */ /** @private */
......
...@@ -464,11 +464,6 @@ void ProfilePickerView::OnProfileForSigninCreated( ...@@ -464,11 +464,6 @@ void ProfilePickerView::OnProfileForSigninCreated(
// browser crashes before finishing the flow. // browser crashes before finishing the flow.
entry->SetIsEphemeral(true); entry->SetIsEphemeral(true);
// TODO(crbug.com/1126913): Record also that we show the sign-in promo
// (it has to be plumbed from js to profile_picker_handler.cc):
// signin_metrics::RecordSigninImpressionUserActionForAccessPoint(
// signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER);
// Record that the sign in process starts (its end is recorded automatically // Record that the sign in process starts (its end is recorded automatically
// by the instance of DiceTurnSyncOnHelper constructed later on). // by the instance of DiceTurnSyncOnHelper constructed later on).
signin_metrics::RecordSigninUserActionForAccessPoint( signin_metrics::RecordSigninUserActionForAccessPoint(
......
...@@ -215,6 +215,11 @@ void ProfilePickerHandler::RegisterMessages() { ...@@ -215,6 +215,11 @@ void ProfilePickerHandler::RegisterMessages() {
"setProfileName", "setProfileName",
base::BindRepeating(&ProfilePickerHandler::HandleSetProfileName, base::BindRepeating(&ProfilePickerHandler::HandleSetProfileName,
base::Unretained(this))); base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"recordSignInPromoImpression",
base::BindRepeating(
&ProfilePickerHandler::HandleRecordSignInPromoImpression,
base::Unretained(this)));
} }
void ProfilePickerHandler::OnJavascriptAllowed() { void ProfilePickerHandler::OnJavascriptAllowed() {
...@@ -454,6 +459,12 @@ void ProfilePickerHandler::OnProfileCreationSuccess( ...@@ -454,6 +459,12 @@ void ProfilePickerHandler::OnProfileCreationSuccess(
profile, Profile::CREATE_STATUS_INITIALIZED); profile, Profile::CREATE_STATUS_INITIALIZED);
} }
void ProfilePickerHandler::HandleRecordSignInPromoImpression(
const base::ListValue* /*args*/) {
signin_metrics::RecordSigninImpressionUserActionForAccessPoint(
signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER);
}
void ProfilePickerHandler::HandleSetProfileName(const base::ListValue* args) { void ProfilePickerHandler::HandleSetProfileName(const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize()); CHECK_EQ(2U, args->GetSize());
const base::Value& profile_path_value = args->GetList()[0]; const base::Value& profile_path_value = args->GetList()[0];
......
...@@ -49,6 +49,9 @@ class ProfilePickerHandler : public content::WebUIMessageHandler, ...@@ -49,6 +49,9 @@ class ProfilePickerHandler : public content::WebUIMessageHandler,
void HandleGetProfileThemeInfo(const base::ListValue* args); void HandleGetProfileThemeInfo(const base::ListValue* args);
void HandleCreateProfile(const base::ListValue* args); void HandleCreateProfile(const base::ListValue* args);
// |args| is unused.
void HandleRecordSignInPromoImpression(const base::ListValue* args);
void OnLoadSigninFinished(bool success); void OnLoadSigninFinished(bool success);
void GatherProfileStatistics(Profile* profile); void GatherProfileStatistics(Profile* profile);
void OnProfileStatisticsReceived(base::FilePath profile_path, void OnProfileStatisticsReceived(base::FilePath profile_path,
......
...@@ -4,14 +4,23 @@ ...@@ -4,14 +4,23 @@
import 'chrome://profile-picker/lazy_load.js'; import 'chrome://profile-picker/lazy_load.js';
import {ManageProfilesBrowserProxyImpl} from 'chrome://profile-picker/profile_picker.js';
import {assertTrue} from '../chai_assert.js'; import {assertTrue} from '../chai_assert.js';
import {isChildVisible} from '../test_util.m.js'; import {isChildVisible} from '../test_util.m.js';
import {TestManageProfilesBrowserProxy} from './test_manage_profiles_browser_proxy.js';
suite('ProfileTypeChoiceTest', function() { suite('ProfileTypeChoiceTest', function() {
/** @type {!ProfileTypeChoiceElement} */ /** @type {!ProfileTypeChoiceElement} */
let choice; let choice;
/** @type {!TestManageProfilesBrowserProxy} */
let browserProxy;
setup(function() { setup(function() {
browserProxy = new TestManageProfilesBrowserProxy();
ManageProfilesBrowserProxyImpl.instance_ = browserProxy;
document.body.innerHTML = ''; document.body.innerHTML = '';
choice = /** @type {!ProfileTypeChoiceElement} */ ( choice = /** @type {!ProfileTypeChoiceElement} */ (
document.createElement('profile-type-choice')); document.createElement('profile-type-choice'));
...@@ -29,4 +38,8 @@ suite('ProfileTypeChoiceTest', function() { ...@@ -29,4 +38,8 @@ suite('ProfileTypeChoiceTest', function() {
test('NotNowButton', function() { test('NotNowButton', function() {
assertTrue(isChildVisible(choice, '#notNowButton')); assertTrue(isChildVisible(choice, '#notNowButton'));
}); });
test('VerifySignInPromoImpressionRecorded', function() {
return browserProxy.whenCalled('recordSignInPromoImpression');
});
}); });
...@@ -22,6 +22,7 @@ export class TestManageProfilesBrowserProxy extends TestBrowserProxy { ...@@ -22,6 +22,7 @@ export class TestManageProfilesBrowserProxy extends TestBrowserProxy {
'loadSignInProfileCreationFlow', 'loadSignInProfileCreationFlow',
'createProfile', 'createProfile',
'setProfileName', 'setProfileName',
'recordSignInPromoImpression',
]); ]);
/** @type {!AutogeneratedThemeColorInfo} */ /** @type {!AutogeneratedThemeColorInfo} */
...@@ -116,4 +117,9 @@ export class TestManageProfilesBrowserProxy extends TestBrowserProxy { ...@@ -116,4 +117,9 @@ export class TestManageProfilesBrowserProxy extends TestBrowserProxy {
setProfileName(profilePath, profileName) { setProfileName(profilePath, profileName) {
this.methodCalled('setProfileName', [profilePath, profileName]); this.methodCalled('setProfileName', [profilePath, profileName]);
} }
/** @override */
recordSignInPromoImpression() {
this.methodCalled('recordSignInPromoImpression');
}
} }
...@@ -893,10 +893,13 @@ void RecordSigninImpressionUserActionForAccessPoint(AccessPoint access_point) { ...@@ -893,10 +893,13 @@ void RecordSigninImpressionUserActionForAccessPoint(AccessPoint access_point) {
base::RecordAction( base::RecordAction(
base::UserMetricsAction("Signin_Impression_FromKaleidoscope")); base::UserMetricsAction("Signin_Impression_FromKaleidoscope"));
break; break;
case AccessPoint::ACCESS_POINT_USER_MANAGER:
base::RecordAction(
base::UserMetricsAction("Signin_Impression_FromUserManager"));
break;
case AccessPoint::ACCESS_POINT_CONTENT_AREA: case AccessPoint::ACCESS_POINT_CONTENT_AREA:
case AccessPoint::ACCESS_POINT_EXTENSIONS: case AccessPoint::ACCESS_POINT_EXTENSIONS:
case AccessPoint::ACCESS_POINT_SUPERVISED_USER: case AccessPoint::ACCESS_POINT_SUPERVISED_USER:
case AccessPoint::ACCESS_POINT_USER_MANAGER:
case AccessPoint::ACCESS_POINT_UNKNOWN: case AccessPoint::ACCESS_POINT_UNKNOWN:
case AccessPoint::ACCESS_POINT_MACHINE_LOGON: case AccessPoint::ACCESS_POINT_MACHINE_LOGON:
case AccessPoint::ACCESS_POINT_SYNC_ERROR_CARD: case AccessPoint::ACCESS_POINT_SYNC_ERROR_CARD:
......
...@@ -22105,6 +22105,15 @@ should be able to be added at any place in this file. ...@@ -22105,6 +22105,15 @@ should be able to be added at any place in this file.
</description> </description>
</action> </action>
<action name="Signin_Impression_FromUserManager" not_user_triggered="true">
<owner>jkrcal@chromium.org</owner>
<owner>droger@chromium.org</owner>
<description>
Recorded when showing sign in entry in the profile creation flow (as part of
the profile picker).
</description>
</action>
<action name="Signin_ImpressionWithAccount_FromAvatarBubbleSignin" <action name="Signin_ImpressionWithAccount_FromAvatarBubbleSignin"
not_user_triggered="true"> not_user_triggered="true">
<owner>msarda@chromium.org</owner> <owner>msarda@chromium.org</owner>
......
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