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

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

Issue 777423004: Skeleton code for experiment setup, which will determine should "Allow to collect URL?" bubble be s… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | components/password_manager/core/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6a9bb5e45e55d4e46959ce59999a21dd1974238e..d2d3407826e4782ae9c6cdbb29055d323af5341b 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -12,6 +12,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/feedback/feedback_data.h"
#include "components/feedback/feedback_util.h"
+#include "components/password_manager/core/browser/password_manager_url_collection_experiment.h"
#include "components/password_manager/core/browser/password_store.h"
#include "components/password_manager/core/common/password_manager_ui.h"
#include "content/public/browser/browser_thread.h"
@@ -38,12 +39,17 @@ int GetFieldWidth(FieldType type) {
: kPasswordFieldSize);
}
+Profile* GetProfileFromWebContents(content::WebContents* web_contents) {
+ if (!web_contents)
+ return nullptr;
+ return Profile::FromBrowserContext(web_contents->GetBrowserContext());
+}
+
void RecordExperimentStatistics(content::WebContents* web_contents,
metrics_util::UIDismissalReason reason) {
- if (!web_contents)
+ Profile* profile = GetProfileFromWebContents(web_contents);
+ if (!profile)
return;
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
password_bubble_experiment::RecordBubbleClosed(profile->GetPrefs(), reason);
}
@@ -91,6 +97,15 @@ void URLCollectionFeedbackSender::SendFeedback() {
feedback_util::SendReport(feedback_data);
}
+void RecordURLsCollectionExperimentStatistics(
+ content::WebContents* web_contents) {
+ Profile* profile = GetProfileFromWebContents(web_contents);
+ if (!profile)
+ return;
+ password_manager::urls_collection_experiment::RecordBubbleClosed(
+ profile->GetPrefs());
+}
+
} // namespace
ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
@@ -189,6 +204,7 @@ void ManagePasswordsBubbleModel::OnBubbleHidden() {
if (password_manager::ui::IsAskSubmitURLState(state_)) {
state_ = password_manager::ui::ASK_USER_REPORT_URL_BUBBLE_SHOWN_STATE;
+ RecordURLsCollectionExperimentStatistics(web_contents());
}
metrics_util::LogUIDismissalReason(dismissal_reason_);
// Other use cases have been reported in the callbacks like OnSaveClicked().
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | components/password_manager/core/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698