| 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 7e3a5e9e4a3e5e1da4ac32d2153a46fc7e1e6a7a..1f11e2f3e9491010184238eb91fce00d0842ccaa 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);
|
| };
|
|
|
|
|