Commit b312372f authored by Kamila's avatar Kamila Committed by Commit Bot

Android Notifications mini infobar variation parameter

This cl adds a new variation parameter that can be used to run A/B
testing on the link we display in the mini infobar on Android.

Change-Id: Ifca13cd4ba9857203ee08118bbca91e1a02c2d1b
BUG: 1084524
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207167
Commit-Queue: Kamila Hasanbega <hkamila@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770565}
parent 67812e98
...@@ -60,8 +60,17 @@ base::string16 GroupedPermissionInfoBarDelegate::GetCompactMessageText() const { ...@@ -60,8 +60,17 @@ base::string16 GroupedPermissionInfoBarDelegate::GetCompactMessageText() const {
} }
base::string16 GroupedPermissionInfoBarDelegate::GetCompactLinkText() const { base::string16 GroupedPermissionInfoBarDelegate::GetCompactLinkText() const {
return l10n_util::GetStringUTF16( switch (QuietNotificationPermissionUiConfig::GetMiniInfobarExpandLinkText()) {
IDS_NOTIFICATION_QUIET_PERMISSION_MINI_INFOBAR_DETAILS_LINK); case QuietNotificationPermissionUiConfig::InfobarLinkTextVariation::kManage:
return l10n_util::GetStringUTF16(IDS_NOTIFICATION_BUTTON_MANAGE);
case QuietNotificationPermissionUiConfig::InfobarLinkTextVariation::
kDetails:
return l10n_util::GetStringUTF16(
IDS_NOTIFICATION_QUIET_PERMISSION_MINI_INFOBAR_DETAILS_LINK);
}
NOTREACHED();
return base::string16();
} }
// TODO(crbug.com/1082737): Many methods of this class switches on the quiet UI // TODO(crbug.com/1082737): Many methods of this class switches on the quiet UI
......
...@@ -28,6 +28,10 @@ const char ...@@ -28,6 +28,10 @@ const char
const char QuietNotificationPermissionUiConfig::kEnableAbusiveRequestWarning[] = const char QuietNotificationPermissionUiConfig::kEnableAbusiveRequestWarning[] =
"enable_abusive_request_warning"; "enable_abusive_request_warning";
// static
const char QuietNotificationPermissionUiConfig::kMiniInfobarExpandLinkText[] =
"mini_infobar_expand_link_text";
// static // static
bool QuietNotificationPermissionUiConfig::IsAdaptiveActivationEnabled() { bool QuietNotificationPermissionUiConfig::IsAdaptiveActivationEnabled() {
if (!base::FeatureList::IsEnabled(features::kQuietNotificationPrompts)) if (!base::FeatureList::IsEnabled(features::kQuietNotificationPrompts))
...@@ -54,6 +58,15 @@ double QuietNotificationPermissionUiConfig::GetCrowdDenyHoldBackChance() { ...@@ -54,6 +58,15 @@ double QuietNotificationPermissionUiConfig::GetCrowdDenyHoldBackChance() {
features::kQuietNotificationPrompts, kCrowdDenyHoldBackChance, 0); features::kQuietNotificationPrompts, kCrowdDenyHoldBackChance, 0);
} }
// static
QuietNotificationPermissionUiConfig::InfobarLinkTextVariation
QuietNotificationPermissionUiConfig::GetMiniInfobarExpandLinkText() {
return base::GetFieldTrialParamByFeatureAsInt(
features::kQuietNotificationPrompts, kMiniInfobarExpandLinkText, 0)
? InfobarLinkTextVariation::kManage
: InfobarLinkTextVariation::kDetails;
}
// static // static
bool QuietNotificationPermissionUiConfig::IsAbusiveRequestBlockingEnabled() { bool QuietNotificationPermissionUiConfig::IsAbusiveRequestBlockingEnabled() {
if (!base::FeatureList::IsEnabled(features::kQuietNotificationPrompts)) if (!base::FeatureList::IsEnabled(features::kQuietNotificationPrompts))
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
// Field trial configuration for the quiet notificaiton permission request UI. // Field trial configuration for the quiet notificaiton permission request UI.
class QuietNotificationPermissionUiConfig { class QuietNotificationPermissionUiConfig {
public: public:
enum class InfobarLinkTextVariation { kDetails = 0, kManage = 1 };
// Name of the boolean variation parameter that determines if the quiet // Name of the boolean variation parameter that determines if the quiet
// notification permission prompt UI should be enabled adaptively after three // notification permission prompt UI should be enabled adaptively after three
// consecutive prompt denies. // consecutive prompt denies.
...@@ -39,6 +41,11 @@ class QuietNotificationPermissionUiConfig { ...@@ -39,6 +41,11 @@ class QuietNotificationPermissionUiConfig {
// If the quiet UI is enabled in preferences, the quiet UI is always used. // If the quiet UI is enabled in preferences, the quiet UI is always used.
static const char kCrowdDenyHoldBackChance[]; static const char kCrowdDenyHoldBackChance[];
// Name of the variation parameter that determines which experimental string
// to use for the link in the mini infobar in Android, which upon being
// clicked, expands the mini infobar to show more options.
static const char kMiniInfobarExpandLinkText[];
// Whether or not adaptive activation is enabled. Adaptive activation means // Whether or not adaptive activation is enabled. Adaptive activation means
// that quiet notifications permission prompts will be turned on after three // that quiet notifications permission prompts will be turned on after three
// consecutive prompt denies. // consecutive prompt denies.
...@@ -54,6 +61,9 @@ class QuietNotificationPermissionUiConfig { ...@@ -54,6 +61,9 @@ class QuietNotificationPermissionUiConfig {
// permission prompt. // permission prompt.
static double GetCrowdDenyHoldBackChance(); static double GetCrowdDenyHoldBackChance();
// The text of the link to be shown in the mini infobar in Android.
static InfobarLinkTextVariation GetMiniInfobarExpandLinkText();
// Whether or not triggering via the abusive requests list is enabled. This // Whether or not triggering via the abusive requests list is enabled. This
// means that on sites with abusive permission request flows, the quiet UI // means that on sites with abusive permission request flows, the quiet UI
// will be shown as a one-off, even when it is not turned on for all sites in // will be shown as a one-off, even when it is not turned on for all sites in
......
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