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

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

Issue 1028163002: Processing USERNAME reply from Autofill server in Password Manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test and changed sending message 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
Index: components/password_manager/core/browser/password_form_manager.cc
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index dc4bf9ac1965a9ce0989811744b23cffc140d326..33a032a0fb18f1a021e85006bae0c6ccd6e1a5d4 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -159,7 +159,11 @@ PasswordFormManager::MatchResultMask PasswordFormManager::DoesManage(
result |= RESULT_ORIGINS_MATCH;
- if (form.username_element == observed_form_.username_element &&
+ // Autofill predictions can overwrite our default username selection so
+ // if this form was parsed with autofill predictions then allow the username
+ // element to be different.
+ if ((form.parsed_using_autofill_predictions ||
+ form.username_element == observed_form_.username_element) &&
form.password_element == observed_form_.password_element) {
result |= RESULT_HTML_ATTRIBUTES_MATCH;
}
@@ -335,6 +339,8 @@ void PasswordFormManager::ProvisionallySave(
// User typed in a new, unknown username.
user_action_ = kUserActionOverrideUsernameAndPassword;
pending_credentials_ = observed_form_;
+ if (credentials.parsed_using_autofill_predictions)
+ pending_credentials_.username_element = credentials.username_element;
pending_credentials_.username_value = credentials.username_value;
pending_credentials_.other_possible_usernames =
credentials.other_possible_usernames;

Powered by Google App Engine
This is Rietveld 408576698