Index: components/autofill/content/renderer/password_autofill_agent.cc |
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc |
index fd9ac7f7b1343a90d80f5ba76cca4b5bb8c4bdf6..49a43eafc4e98016ab211e0843887e899b5d1566 100644 |
--- a/components/autofill/content/renderer/password_autofill_agent.cc |
+++ b/components/autofill/content/renderer/password_autofill_agent.cc |
@@ -722,6 +722,12 @@ void PasswordAutofillAgent::UpdateStateForTextChange( |
if (element.isTextField()) |
nonscript_modified_values_[element] = element.value(); |
+ LoginToPasswordInfoMap::iterator password_info_iter = |
+ login_to_password_info_.find(element); |
+ if (password_info_iter != login_to_password_info_.end()) { |
+ password_info_iter->second.username_was_edited = true; |
+ } |
+ |
DCHECK_EQ(element.document().frame(), render_frame()->GetWebFrame()); |
if (element.isPasswordField()) { |
@@ -858,7 +864,9 @@ bool PasswordAutofillAgent::ShowSuggestions( |
// is no username or the corresponding username element is not editable since |
// it is only in that case that the username element does not have a |
// suggestions popup. |
- if (element.isPasswordField() && username_is_available) |
+ if (element.isPasswordField() && username_is_available && |
+ (!password_info->fill_data.is_possible_change_password_form || |
+ password_info->username_was_edited)) |
return true; |
// Chrome should never show more than one account for a password element since |
@@ -1287,7 +1295,9 @@ void PasswordAutofillAgent::OnFindFocusedPasswordForm() { |
// PasswordAutofillAgent, private: |
PasswordAutofillAgent::PasswordInfo::PasswordInfo() |
- : backspace_pressed_last(false), password_was_edited_last(false) { |
+ : backspace_pressed_last(false), |
+ password_was_edited_last(false), |
+ username_was_edited(false) { |
} |
bool PasswordAutofillAgent::ShowSuggestionPopup( |