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

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

Issue 557703002: Refactoring PasswordAutofillAgent::FillUserNameAndPassword function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per reviewers comments and discussion. Created 6 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 | « no previous file | 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 9e3e0d87fef189c727540f73b52222a8dd24e80b..86ff3779dc76fb185f1e36c899ca5c95f9d6cf88 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -965,6 +965,10 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
base::string16 username;
base::string16 password;
+ // Don't fill username if password can't be set.
+ if (!IsElementAutocompletable(*password_element))
+ return false;
+
// Look for any suitable matches to current field text.
if (DoUsernamesMatch(fill_data.basic_data.fields[0].value,
current_username,
@@ -1011,11 +1015,6 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
// TODO(tkent): Check maxlength and pattern for both username and password
// fields.
- // Don't fill username if password can't be set.
- if (!IsElementAutocompletable(*password_element)) {
- return false;
- }
-
// Input matches the username, fill in required values.
if (IsElementAutocompletable(*username_element)) {
username_element->setValue(username, true);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698