Commit 305d6ab0 authored by Ramin Halavati's avatar Ramin Halavati Committed by Chromium LUCI CQ

Add Guest availability metric for signin Intercept.

"Signin.Intercept.Guest.Availability" metric is added to record if Guest
option is available at signin intercept or not and why.

Bug: 1157764
Change-Id: I00dc3bb07b6b6cec758c206b1046a0c2e767d7b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620621Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarWeilun Shi <sweilun@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842910}
parent 0ed28ecb
......@@ -88,11 +88,35 @@ bool HasNoBrowser(content::WebContents* web_contents) {
return chrome::FindBrowserWithWebContents(web_contents) == nullptr;
}
bool GuestOptionAvailable() {
return Profile::IsEphemeralGuestProfileEnabled() &&
!ProfileManager::GuestProfileExists() &&
g_browser_process->local_state()->GetBoolean(
prefs::kBrowserGuestModeEnabled);
// Different conditions which make Guest option available or not.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SigninInterceptGuestAvailability {
kAvailable = 0,
kGuestAlreadyOpen = 1,
kGuestBlocked = 2,
kEphemeralGuestDisabled = 3,
kMaxValue = kEphemeralGuestDisabled
};
SigninInterceptGuestAvailability GetGuestOptionAvailablity() {
if (!Profile::IsEphemeralGuestProfileEnabled())
return SigninInterceptGuestAvailability::kEphemeralGuestDisabled;
if (ProfileManager::GuestProfileExists())
return SigninInterceptGuestAvailability::kGuestAlreadyOpen;
if (!g_browser_process->local_state()->GetBoolean(
prefs::kBrowserGuestModeEnabled)) {
return SigninInterceptGuestAvailability::kGuestBlocked;
}
return SigninInterceptGuestAvailability::kAvailable;
}
void RecordGuestOptionAvailablity(
SigninInterceptGuestAvailability availability) {
base::UmaHistogramEnumeration("Signin.Intercept.Guest.Availability",
availability);
}
} // namespace
......@@ -407,10 +431,12 @@ void DiceWebSigninInterceptor::OnExtendedAccountInfoUpdated(
->GetProfileAttributesStorage()
.GetProfileAttributesWithPath(profile_->GetPath(), &entry);
SkColor profile_color = GenerateNewProfileColor(entry).color;
auto guest_option_availability = GetGuestOptionAvailablity();
Delegate::BubbleParameters bubble_parameters{
*interception_type, info, GetPrimaryAccountInfo(identity_manager_),
GetAutogeneratedThemeColors(profile_color).frame_color,
GuestOptionAvailable()};
guest_option_availability ==
SigninInterceptGuestAvailability::kAvailable};
interception_bubble_handle_ = delegate_->ShowSigninInterceptionBubble(
web_contents(), bubble_parameters,
base::BindOnce(&DiceWebSigninInterceptor::OnProfileCreationChoice,
......@@ -420,6 +446,7 @@ void DiceWebSigninInterceptor::OnExtendedAccountInfoUpdated(
*interception_type == SigninInterceptionType::kEnterprise
? SigninInterceptionHeuristicOutcome::kInterceptEnterprise
: SigninInterceptionHeuristicOutcome::kInterceptMultiUser);
RecordGuestOptionAvailablity(guest_option_availability);
}
void DiceWebSigninInterceptor::OnExtendedAccountInfoFetchTimeout() {
......
......@@ -68700,6 +68700,13 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
<int value="10" label="Undo">The sync was aborted with an undo button.</int>
</enum>
<enum name="SigninInterceptGuestAvailability">
<int value="0" label="Guest option available"/>
<int value="1" label="Guest already open"/>
<int value="2" label="Guest mode blocked by policy"/>
<int value="3" label="Ephemeral Guest profile disabled"/>
</enum>
<enum name="SigninInterceptHeuristicOutcome">
<int value="0" label="Intercept: profile switch"/>
<int value="1" label="Intercept: multi-user"/>
......@@ -407,6 +407,16 @@ prefs when the profile is loaded. -->
</summary>
</histogram>
<histogram name="Signin.Intercept.Guest.Availability"
enum="SigninInterceptGuestAvailability" expires_after="2021-08-12">
<owner>rhalavati@chromium.org</owner>
<owner>droger@chromium.org</owner>
<summary>
Records whether Guest option was available prior to showing signin intercept
and if not, why.
</summary>
</histogram>
<histogram name="Signin.Intercept.HeuristicOutcome"
enum="SigninInterceptHeuristicOutcome" expires_after="2021-08-12">
<owner>droger@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