Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Unified Diff: components/password_manager/core/browser/password_bubble_experiment.cc

Issue 2036323002: Implement the UI logic behind the Sign In promo in the password bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/password_bubble_experiment.cc
diff --git a/components/password_manager/core/browser/password_bubble_experiment.cc b/components/password_manager/core/browser/password_bubble_experiment.cc
index ab772cb4119a306d16e139972488537fa12ea14d..1001bf3b4e2d6fccc2408873a2cac246710cb6f9 100644
--- a/components/password_manager/core/browser/password_bubble_experiment.cc
+++ b/components/password_manager/core/browser/password_bubble_experiment.cc
@@ -18,6 +18,8 @@
namespace password_bubble_experiment {
const char kBrandingExperimentName[] = "PasswordBranding";
+const char kChromeSignInPasswordPromoExperimentName[] = "SignInPasswordPromo";
+const char kChromeSignInPasswordPromoThresholdParam[] = "dismissal_threshold";
const char kSmartBubbleExperimentName[] = "PasswordSmartBubble";
const char kSmartBubbleThresholdParam[] = "dismissal_count";
const char kSmartLockBrandingGroupName[] = "SmartLockBranding";
@@ -31,6 +33,12 @@ void RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(
password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF);
+
+ registry->RegisterBooleanPref(
+ password_manager::prefs::kWasSignInPasswordPromoClicked, false);
+
+ registry->RegisterIntegerPref(
+ password_manager::prefs::kNumberSignInPasswordPromoShown, 0);
}
int GetSmartBubbleDismissalThreshold() {
@@ -94,4 +102,18 @@ void TurnOffAutoSignin(PrefService* prefs) {
false);
}
+bool ShouldShowChromeSignInPasswordPromo(PrefService* prefs) {
+ // Query the group first for correct UMA reporting.
+ std::string param = variations::GetVariationParamValue(
+ kChromeSignInPasswordPromoExperimentName,
+ kChromeSignInPasswordPromoThresholdParam);
+ int threshold = 0;
+ return base::StringToInt(param, &threshold) &&
+ !prefs->GetBoolean(
+ password_manager::prefs::kWasSignInPasswordPromoClicked) &&
+ prefs->GetInteger(
+ password_manager::prefs::kNumberSignInPasswordPromoShown) <
+ threshold;
+}
+
} // namespace password_bubble_experiment

Powered by Google App Engine
This is Rietveld 408576698