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..315894fc6e85d512b91609a19523ffd75092aec5 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 we allow that |
+ // username element can be different. |
Garrett Casto
2015/03/24 01:31:12
Nit: Should be either "allow the username element
dvadym
2015/03/24 16:38:49
Done.
|
+ 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; |