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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 1161023008: Suggest to fill password change forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny fix Created 5 years, 6 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/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(

Powered by Google App Engine
This is Rietveld 408576698