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

Unified Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 1099033004: Add a text/password field count metric for empty username forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Superfluous include Created 5 years, 7 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') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/password_form_conversion_utils.cc
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc
index 44fc3230804714760d65c1d24e5e0a4becc683f2..d0e0afda9bbd07854d247fdaaaa9575f0c57acea 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/core/common/form_data_predictions.h"
@@ -239,6 +240,7 @@ void GetPasswordForm(
password_form->username_marked_by_site = false;
std::vector<WebInputElement> passwords;
std::vector<base::string16> other_possible_usernames;
+ int num_text_and_password_fields = 0;
WebVector<WebFormControlElement> control_elements;
form.getFormControlElements(control_elements);
@@ -259,6 +261,12 @@ void GetPasswordForm(
layout_sequence.push_back('P');
else
layout_sequence.push_back('N');
+
+ // Count the total number of text and password fields. Note that
vabr (Chromium) 2015/05/12 10:26:02 nit: The comment is clear and correct, but probabl
msramek 2015/05/12 10:50:44 Acknowledged.
+ // in renderer, |PasswordInputType| is a subclass of |TextFieldInputType|,
+ // but for consistency with the rest of the code we use the term "text"
+ // to refer specifically to a non-password text field.
+ ++num_text_and_password_fields;
}
// If the password field is readonly, the page is likely using a virtual
@@ -368,6 +376,12 @@ void GetPasswordForm(
}
}
password_form->username_value = username_value;
+ } else {
vabr (Chromium) 2015/05/12 10:26:02 Do you want to report this even if there are not p
msramek 2015/05/12 10:50:44 Do you mean no password fields found? No. But if I
vabr (Chromium) 2015/05/12 11:06:11 Yes, sorry for the confusion, I meant password fie
msramek 2015/05/12 11:27:03 Interesting. I would expect none of this code to t
vabr (Chromium) 2015/05/12 11:33:58 This has the caveat that you won't get this count
msramek 2015/05/12 12:13:47 I know. But in this case the password manager will
+ // To get a better idea on how forms without a username field look like,
+ // report the total number of text and password fields.
+ UMA_HISTOGRAM_COUNTS_100(
+ "PasswordManager.EmptyUsernames.TextAndPasswordFieldCount",
+ num_text_and_password_fields);
vabr (Chromium) 2015/05/12 10:26:02 Alternatively, you can use layout_sequence.size().
msramek 2015/05/12 10:50:44 No, let's use layout_sequence.size(). I just reall
}
WebInputElement password;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698