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

Unified Diff: components/password_manager/core/browser/password_form_manager.h

Issue 1049003002: [Password Manager] Add UMA stats for submitted form type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 | components/password_manager/core/browser/password_form_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_form_manager.h
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h
index 1d0c5cd90daa467080079ea87ca65264662f9900..d7c49a89172d6b86dc685f2bb6fa095790407844 100644
--- a/components/password_manager/core/browser/password_form_manager.h
+++ b/components/password_manager/core/browser/password_form_manager.h
@@ -93,16 +93,10 @@ class PasswordFormManager : public PasswordStoreConsumer {
// the same thread!
bool HasCompletedMatching() const;
- // When attempting to provisionally save |form|, call this to check if it is
- // actually a change-password form which should be ignored, i.e., whether:
- // * the username was not explicitly marked with "autocomplete=username", and
- // * both the current and new password fields are non-empty, and
- // * the username and password do not match any credentials already stored.
- // In these cases the username field is detection is unreliable (there might
- // even be none), and the user should not be bothered with saving a
- // potentially malformed credential. Once we handle change password forms
- // correctly, this method should be replaced accordingly.
- bool IsIgnorableChangePasswordForm(const autofill::PasswordForm& form) const;
+ // Update |this| with the |form| that was actually submitted. Used to
+ // determine what type the submitted form is for
+ // IsIgnorableChangePasswordForm() and UMA stats.
+ void SetSubmittedForm(const autofill::PasswordForm& form);
// Determines if the user opted to 'never remember' passwords for this form.
bool IsBlacklisted() const;
@@ -161,6 +155,22 @@ class PasswordFormManager : public PasswordStoreConsumer {
void SubmitPassed();
void SubmitFailed();
+ // When attempting to provisionally save |form|, call this to check if it is
+ // actually a change-password form which should be ignored, i.e., whether:
+ // * the username was not explicitly marked with "autocomplete=username", and
+ // * both the current and new password fields are non-empty, and
+ // * the username and password do not match any credentials already stored.
+ // In these cases the username field is detection is unreliable (there might
+ // even be none), and the user should not be bothered with saving a
+ // potentially malformed credential. Once we handle change password forms
+ // correctly, this method should be replaced accordingly.
+ //
+ // Must be called after SetSubmittedForm().
+ bool is_ignorable_change_password_form() const {
+ DCHECK(form_type_ != kFormTypeUnspecified);
+ return is_ignorable_change_password_form_;
+ }
+
// Returns the username associated with the credentials.
const base::string16& associated_username() const {
return pending_credentials_.username_value;
@@ -235,6 +245,21 @@ class PasswordFormManager : public PasswordStoreConsumer {
kSubmitResultMax
};
+ // What the form is used for. kFormTypeUnspecified is only set before
+ // the SetSubmittedForm() is called, and should never be actually uploaded.
+ enum FormType {
+ kFormTypeLogin,
+ kFormTypeLoginNoUsername,
+ kFormTypeChangePasswordEnabled,
+ kFormTypeChangePasswordDisabled,
+ kFormTypeChangePasswordNoUsername,
+ kFormTypeSignup,
+ kFormTypeSignupNoUsername,
+ kFormTypeLoginAndSignup,
+ kFormTypeUnspecified,
+ kFormTypeMax
+ };
+
// The maximum number of combinations of the three preceding enums.
// This is used when recording the actions taken by the form in UMA.
static const int kMaxNumActionsTaken =
@@ -341,6 +366,10 @@ class PasswordFormManager : public PasswordStoreConsumer {
// multiple matches (when first saved, a login is marked preferred).
const autofill::PasswordForm* preferred_match_;
+ // If the submitted form is for a change password form and the username
+ // doesn't match saved credentials.
+ bool is_ignorable_change_password_form_;
+
typedef enum {
PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find
// matching login information from password store.
@@ -374,6 +403,11 @@ class PasswordFormManager : public PasswordStoreConsumer {
UserAction user_action_;
SubmitResult submit_result_;
+ // Form type of the form that |this| is managing. Set after SetSubmittedForm()
+ // as our classification of the form can change depending on what data the
+ // user has entered.
+ FormType form_type_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordFormManager);
};
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_form_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698