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

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

Issue 2985373002: Revert of [Password Manager] Send username correction votes (Closed)
Patch Set: Created 3 years, 5 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_form_conversion_utils.cc
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc
index e02d83dbb53d099739cbb77a85eb39c9b49addfa..20c9ca72572634dd20a37c3cc869b4721b8ee213 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -141,15 +141,15 @@
synthetic_form->document = web_form.document();
}
-// Helper function that removes |possible_username_pair| from the vector
+// Helper function that removes |username_element.value()| from the vector
// |other_possible_usernames|, if the value presents in the vector.
void ExcludeUsernameFromOtherUsernamesList(
- const PossibleUsernamePair& possible_username_pair,
- PossibleUsernamesVector* other_possible_usernames) {
- other_possible_usernames->erase(
- std::remove(other_possible_usernames->begin(),
- other_possible_usernames->end(), possible_username_pair),
- other_possible_usernames->end());
+ const WebInputElement& username_element,
+ std::vector<base::string16>* other_possible_usernames) {
+ other_possible_usernames->erase(std::remove(other_possible_usernames->begin(),
+ other_possible_usernames->end(),
+ username_element.value().utf16()),
+ other_possible_usernames->end());
}
// Helper to determine which password is the main (current) one, and which is
@@ -367,12 +367,6 @@
}
}
-autofill::PossibleUsernamePair MakePossibleUsernamePair(
- const blink::WebInputElement& input) {
- return autofill::PossibleUsernamePair(input.value().utf16(),
- input.nameForAutofill().utf16());
-}
-
// Get information about a login form encapsulated in a PasswordForm struct.
// If an element of |form| has an entry in |nonscript_modified_values|, the
// associated string is used instead of the element's value to create
@@ -388,7 +382,7 @@
std::vector<WebInputElement> passwords;
std::map<blink::WebInputElement, blink::WebInputElement>
last_text_input_before_password;
- autofill::PossibleUsernamesVector other_possible_usernames;
+ std::vector<base::string16> other_possible_usernames;
// Bail if this is a GAIA passwords site reauthentication form, so that
// the form will be ignored.
@@ -488,8 +482,7 @@
// autofill, not for form identification, and blank autofill entries
// are not useful, so we do not collect empty strings.
if (!input_element->value().isEmpty())
- other_possible_usernames.push_back(
- MakePossibleUsernamePair(*input_element));
+ other_possible_usernames.push_back(input_element->value().utf16());
} else {
// The first element marked with autocomplete='username'. Take the
// hint and treat it as the username (overruling the tentative choice
@@ -513,8 +506,7 @@
if (username_element.isNull())
latest_input_element = *input_element;
if (!input_element->value().isEmpty())
- other_possible_usernames.push_back(
- MakePossibleUsernamePair(*input_element));
+ other_possible_usernames.push_back(input_element->value().utf16());
}
}
}
@@ -534,9 +526,8 @@
if (username_element.isNull() && !new_password.isNull())
username_element = last_text_input_before_password[new_password];
if (!username_element.isNull())
- ExcludeUsernameFromOtherUsernamesList(
- MakePossibleUsernamePair(username_element),
- &other_possible_usernames);
+ ExcludeUsernameFromOtherUsernamesList(username_element,
+ &other_possible_usernames);
}
password_form->layout = SequenceToLayout(layout_sequence);
@@ -551,12 +542,10 @@
if (map_has_username_prediction &&
(username_element_iterator == predicted_elements.end() ||
username_element_iterator->second != PREDICTION_USERNAME)) {
- ExcludeUsernameFromOtherUsernamesList(
- MakePossibleUsernamePair(predicted_username_element),
- &other_possible_usernames);
+ ExcludeUsernameFromOtherUsernamesList(predicted_username_element,
+ &other_possible_usernames);
if (!username_element.isNull()) {
- other_possible_usernames.push_back(
- MakePossibleUsernamePair(username_element));
+ other_possible_usernames.push_back(username_element.value().utf16());
}
username_element = predicted_username_element;
password_form->was_parsed_using_autofill_predictions = true;

Powered by Google App Engine
This is Rietveld 408576698