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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 711043002: Finch experiment for limiting the password bubble annoyance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 years, 1 month 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: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index 1e1b433b9d7fca4ff070df9044ca860312dbd713..dd596716f4b297015f7051f80957d67a17fc3b4e 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
+#include "chrome/browser/ui/passwords/password_bubble_experiment.h"
#include "chrome/grit/generated_resources.h"
#include "components/password_manager/core/browser/password_store.h"
#include "components/password_manager/core/common/password_manager_ui.h"
@@ -33,6 +34,15 @@ int GetFieldWidth(FieldType type) {
: kPasswordFieldSize);
}
+void RecordExperimentStatistics(content::WebContents* web_contents,
+ metrics_util::UIDismissalReason reason) {
+ if (!web_contents)
+ return;
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ password_bubble_experiment::RecordBubbleClosed(profile->GetPrefs(), reason);
+}
+
} // namespace
ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
@@ -109,15 +119,20 @@ void ManagePasswordsBubbleModel::OnBubbleHidden() {
return;
metrics_util::LogUIDismissalReason(dismissal_reason_);
+ // Other use cases have been reported in the callbacks like OnSaveClicked().
+ if (dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION)
+ RecordExperimentStatistics(web_contents(), dismissal_reason_);
}
void ManagePasswordsBubbleModel::OnNopeClicked() {
dismissal_reason_ = metrics_util::CLICKED_NOPE;
+ RecordExperimentStatistics(web_contents(), dismissal_reason_);
state_ = password_manager::ui::PENDING_PASSWORD_STATE;
}
void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() {
dismissal_reason_ = metrics_util::CLICKED_NEVER;
+ RecordExperimentStatistics(web_contents(), dismissal_reason_);
ManagePasswordsUIController* manage_passwords_ui_controller =
ManagePasswordsUIController::FromWebContents(web_contents());
manage_passwords_ui_controller->NeverSavePassword();
@@ -134,6 +149,7 @@ void ManagePasswordsBubbleModel::OnUnblacklistClicked() {
void ManagePasswordsBubbleModel::OnSaveClicked() {
dismissal_reason_ = metrics_util::CLICKED_SAVE;
+ RecordExperimentStatistics(web_contents(), dismissal_reason_);
ManagePasswordsUIController* manage_passwords_ui_controller =
ManagePasswordsUIController::FromWebContents(web_contents());
manage_passwords_ui_controller->SavePassword();
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/ui/passwords/manage_passwords_ui_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698