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

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

Issue 2747733004: [Password Manager] Send username correction votes (Closed)
Patch Set: Minor changes 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 fa0257629d4a0411791a19be3a2de1b3d4f7bb70..0b0981a134f38d0406495b6e6867adbed9aec735 100644
--- a/components/password_manager/core/browser/password_form_manager.h
+++ b/components/password_manager/core/browser/password_form_manager.h
@@ -210,6 +210,11 @@ class PasswordFormManager : public FormFetcher::Consumer {
const autofill::PasswordForm& observed_form() const { return observed_form_; }
+ // Returns the username correction vote, if it exists, otherwise nullptr.
+ const autofill::PasswordForm* username_correction_vote() const {
+ return username_correction_vote_.get();
+ }
+
bool is_possible_change_password_form_without_username() const {
return is_possible_change_password_form_without_username_;
}
@@ -350,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 SendVoteOnCredentialsReusage(const autofill::PasswordForm& observed,
vabr (Chromium) 2017/03/16 21:00:42 nit: Reusage -> Reuse
kolos1 2017/03/17 14:09:34 Done.
+ 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
@@ -364,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.
@@ -376,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|.
@@ -462,6 +479,13 @@ 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 this credentials.
vabr (Chromium) 2017/03/16 21:00:42 Not sure what "this credentials" refer to. It is a
kolos1 2017/03/17 14:09:34 Fixed.
+ // |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