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 47429bd652610226b9cd6e39df5f41691cfa4aac..40cf155a0e4d5f9ce2b5d11d5df4e1d3fe5419ff 100644 |
--- a/components/password_manager/core/browser/password_form_manager.h |
+++ b/components/password_manager/core/browser/password_form_manager.h |
@@ -355,8 +355,8 @@ class PasswordFormManager : public FormFetcher::Consumer { |
// Autofill server to vote for the correct username field, and also so that |
// we will trigger password generation in the future. This function will |
// update generation_upload_status of |pending| if an upload is performed. |
- void SendAutofillVotes(const autofill::PasswordForm& observed, |
- autofill::PasswordForm* pending); |
+ void SendVoteOnCredentialsReuse(const autofill::PasswordForm& observed, |
+ autofill::PasswordForm* pending); |
// Update all login matches to reflect new preferred state - preferred flag |
// will be reset on all matched logins that different than the current |
@@ -369,6 +369,17 @@ class PasswordFormManager : public FormFetcher::Consumer { |
bool UpdatePendingCredentialsIfOtherPossibleUsername( |
const base::string16& username); |
+ // Searches for |username| in |other_possible_usernames| of |best_matches_| |
+ // and |not_best_matches_|. If the username value is found, the match is saved |
+ // to |username_correction_vote_|. |
+ void FindCorrectedUsernameElement(const base::string16& username); |
+ |
+ // Searches for |username| in |other_possible_usernames| of |match|. If the |
+ // username value is found, the match is saved to |username_correction_vote_| |
+ // and the function returns true. |
+ bool FindUsernameInOtherPossibleUsernames(const autofill::PasswordForm& match, |
+ const base::string16& username); |
+ |
// Returns true if |form| is a username update of a credential already in |
// |best_matches_|. Sets |pending_credentials_| to the appropriate |
// PasswordForm if it returns true. |
@@ -381,7 +392,8 @@ class PasswordFormManager : public FormFetcher::Consumer { |
// Tries to set all votes (e.g. autofill field types, generation vote) to |
// a |FormStructure| and upload it to the server. Returns true on success. |
- bool UploadPasswordVote(const autofill::ServerFieldType& password_type, |
+ bool UploadPasswordVote(const autofill::PasswordForm& form_to_upload, |
+ const autofill::ServerFieldType& password_type, |
const std::string& login_form_signature); |
// Adds a vote on password generation usage to |form_structure|. |
@@ -467,6 +479,14 @@ class PasswordFormManager : public FormFetcher::Consumer { |
// option should apply. |
OtherPossibleUsernamesAction other_possible_username_action_; |
+ // If the user typed username that doesn't match any saved credentials, but |
+ // matches an entry from |other_possible_usernames| of a saved credential, |
+ // then |username_correction_vote_| stores the credential with matched |
+ // username. The matched credential is copied to |username_correction_vote_|, |
+ // but |username_correction_vote_.username_element| is set to the name of the |
+ // field where matched username was found. |
+ std::unique_ptr<autofill::PasswordForm> username_correction_vote_; |
+ |
// The origin url path of observed_form_ tokenized, for convenience when |
// scoring. |
const std::vector<std::string> form_path_segments_; |