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

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

Issue 2317983002: Enable manual password autofilling if the username field is read-only. (Closed)
Patch Set: Add IsAutocompletable check. Small tests refactoring. Created 4 years, 3 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 34e28598f3145eb9c75ac0ff73b0ef58e46d428d..61f31211bb530992057dab8fbe08c0f7c0b0e64d 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -703,8 +703,6 @@ bool PasswordAutofillAgent::FillSuggestion(
if (!FindPasswordInfoForElement(*element, &username_element,
&password_element, &password_info) ||
- (!username_element.isNull() &&
- !IsElementAutocompletable(username_element)) ||
!IsElementAutocompletable(password_element)) {
return false;
}
@@ -713,7 +711,8 @@ bool PasswordAutofillAgent::FillSuggestion(
if (element->isPasswordField()) {
password_info->password_field_suggestion_was_accepted = true;
password_info->password_field = password_element;
- } else if (!username_element.isNull()) {
+ } else if (!username_element.isNull() &&
+ IsElementAutocompletable(username_element)) {
username_element.setValue(blink::WebString(username), true);
username_element.setAutofilled(true);
UpdateFieldValueAndPropertiesMaskMap(username_element, &username,
@@ -749,13 +748,12 @@ bool PasswordAutofillAgent::PreviewSuggestion(
if (!FindPasswordInfoForElement(*element, &username_element,
&password_element, &password_info) ||
- (!username_element.isNull() &&
- !IsElementAutocompletable(username_element)) ||
!IsElementAutocompletable(password_element)) {
return false;
}
- if (!element->isPasswordField() && !username_element.isNull()) {
+ if (!element->isPasswordField() && !username_element.isNull() &&
+ IsElementAutocompletable(username_element)) {
if (username_query_prefix_.empty())
username_query_prefix_ = username_element.value();
« 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