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

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

Issue 2747733004: [Password Manager] Send username correction votes (Closed)
Patch Set: Rebase Created 3 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
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 8fe73d75a0dca729a16d9d8eb7a3fb07bbc36fed..1cc924fbeefcce0f91c524245ffdfc81c5311645 100644
--- a/components/password_manager/core/browser/password_form_manager.h
+++ b/components/password_manager/core/browser/password_form_manager.h
@@ -361,8 +361,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
@@ -375,6 +375,19 @@ 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 in
+ // |other_possible_usernames| and the password value of the match is equal to
+ // |password|, the match is saved to |username_correction_vote_|.
+ void FindCorrectedUsernameElement(const base::string16& username,
+ const base::string16& password);
+
+ // 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.
@@ -387,7 +400,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|.
@@ -473,6 +487,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_;

Powered by Google App Engine
This is Rietveld 408576698