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

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

Issue 1182913004: Add a metric for autofilled Android credentials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 5 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_manager.cc
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 8f9c6faeb1449bfa44e431eedc262b9cf2021077..f39051fb6716887568d79cee805d001c4d71ca5c 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -15,6 +15,7 @@
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/common/form_data_predictions.h"
#include "components/autofill/core/common/password_form_field_prediction_map.h"
+#include "components/password_manager/core/browser/affiliation_utils.h"
#include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
#include "components/password_manager/core/browser/password_autofill_manager.h"
#include "components/password_manager/core/browser/password_form_manager.h"
@@ -110,6 +111,19 @@ bool ServerTypeToPrediction(autofill::ServerFieldType server_field_type,
return true;
}
+bool ContainsAndroidCredentials(
+ const autofill::PasswordFormFillData& fill_data) {
+ for (const auto& login : fill_data.additional_logins) {
+ if (FacetURI::FromPotentiallyInvalidSpec(
+ login.second.realm).IsValidAndroidFacetURI()) {
+ return true;
+ }
+ }
+
+ return FacetURI::FromPotentiallyInvalidSpec(
+ fill_data.preferred_realm).IsValidAndroidFacetURI();
+}
+
} // namespace
// static
@@ -671,6 +685,8 @@ void PasswordManager::Autofill(password_manager::PasswordManagerDriver* driver,
&fill_data);
if (logger)
logger->LogBoolean(Logger::STRING_WAIT_FOR_USERNAME, wait_for_username);
+ UMA_HISTOGRAM_BOOLEAN("PasswordManager.OfferedToFillAndroidCredentials",
+ ContainsAndroidCredentials(fill_data));
driver->FillPasswordForm(fill_data);
break;
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698