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 d904e23fe206c64acaa22733c9e444c9fee23f93..3b104547881e9ab4d8bc49638b47ca179ea0bf0c 100644 |
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
@@ -10,6 +10,7 @@ |
#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_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 "ui/base/l10n/l10n_util.h" |
@@ -34,12 +35,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); |
} |
@@ -50,6 +56,15 @@ base::string16 PendingStateTitleBasedOnSavePasswordPref( |
: IDS_SAVE_PASSWORD); |
} |
+void RecordURLSCollectionExperimentStatistics( |
battre
2014/12/09 11:02:16
nit: RecordURLsCollectionExperimentStatistics
|
+ content::WebContents* web_contents) { |
battre
2014/12/09 11:02:16
Does this fit into one line?
melandory
2014/12/09 23:52:35
67 symbols
|
+ Profile* profile = GetProfileFromWebContents(web_contents); |
+ if (!profile) |
+ return; |
+ password_manager::urls_collection_experiment::RecordBubbleClosed( |
+ profile->GetPrefs()); |
+} |
+ |
} // namespace |
ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( |
@@ -148,6 +163,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(). |