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

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

Issue 2716873002: More robust fill password fields on click. (Closed)
Patch Set: Update comment Created 3 years, 10 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
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1120b1e7543dca9938cbb06b27a56d944777685e..abac9479d637fa6a8995b68284d83cbf1251bc6c 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1432,6 +1432,19 @@ void PasswordAutofillAgent::GetFillableElementFromFormData(
if (elements)
elements->push_back(main_element);
}
+
+ // This is a fallback, if for some reasons elements for filling were not found
+ // (for example because they were renamed by JavaScript) then add fill data
+ // for |web_input_to_password_info_|. When the user clicks on a password
+ // field which is not a key in |web_input_to_password_info_|, the first
+ // element from |web_input_to_password_info_| will be used in
+ // PasswordAutofillAgent::FindPasswordInfoForElement to propose to fill.
+ if (web_input_to_password_info_.empty()) {
+ PasswordInfo password_info;
+ password_info.fill_data = form_data;
+ password_info.key = key;
+ web_input_to_password_info_[blink::WebInputElement()] = password_info;
+ }
}
void PasswordAutofillAgent::FocusedNodeHasChanged(const blink::WebNode& node) {
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698