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

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

Issue 2148303005: [Password Generation] Sends the flag whether a field has nonempty user input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes addressed to reviewer comments Created 4 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 4c2437ffdce72f35a37c33b368eab68adbdc6a32..37f0e81c3c516af9c53bccb4673a9885b510c4e4 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -350,10 +350,11 @@ void FoundVisiblePasswordAndVisibleUsernameBeforePassword(
// 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
// the PasswordForm.
-bool GetPasswordForm(const SyntheticForm& form,
- PasswordForm* password_form,
- const ModifiedValues* nonscript_modified_values,
- const FormsPredictionsMap* form_predictions) {
+bool GetPasswordForm(
+ const SyntheticForm& form,
+ PasswordForm* password_form,
+ const FieldValueAndPropertiesMaskMap* nonscript_modified_values,
+ const FormsPredictionsMap* form_predictions) {
WebInputElement latest_input_element;
WebInputElement username_element;
password_form->username_marked_by_site = false;
@@ -538,7 +539,7 @@ bool GetPasswordForm(const SyntheticForm& form,
auto username_iterator =
nonscript_modified_values->find(username_element);
if (username_iterator != nonscript_modified_values->end()) {
- base::string16 typed_username_value = username_iterator->second;
+ base::string16 typed_username_value = username_iterator->second.first;
if (!base::StartsWith(
base::i18n::ToLower(username_value),
base::i18n::ToLower(typed_username_value),
@@ -567,7 +568,7 @@ bool GetPasswordForm(const SyntheticForm& form,
if (nonscript_modified_values != nullptr) {
auto password_iterator = nonscript_modified_values->find(password);
if (password_iterator != nonscript_modified_values->end())
- password_value = password_iterator->second;
+ password_value = password_iterator->second.first;
}
password_form->password_value = password_value;
}
@@ -646,7 +647,7 @@ bool IsGaiaReauthenticationForm(
std::unique_ptr<PasswordForm> CreatePasswordFormFromWebForm(
const WebFormElement& web_form,
- const ModifiedValues* nonscript_modified_values,
+ const FieldValueAndPropertiesMaskMap* field_value_and_properties_map,
const FormsPredictionsMap* form_predictions) {
if (web_form.isNull())
return std::unique_ptr<PasswordForm>();
@@ -660,11 +661,12 @@ std::unique_ptr<PasswordForm> CreatePasswordFormFromWebForm(
PopulateSyntheticFormFromWebForm(web_form, &synthetic_form);
WebFormElementToFormData(web_form, blink::WebFormControlElement(),
+ field_value_and_properties_map,
form_util::EXTRACT_NONE, &password_form->form_data,
NULL /* FormFieldData */);
if (!GetPasswordForm(synthetic_form, password_form.get(),
- nonscript_modified_values, form_predictions))
+ field_value_and_properties_map, form_predictions))
return std::unique_ptr<PasswordForm>();
return password_form;
@@ -672,7 +674,7 @@ std::unique_ptr<PasswordForm> CreatePasswordFormFromWebForm(
std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements(
const WebFrame& frame,
- const ModifiedValues* nonscript_modified_values,
+ const FieldValueAndPropertiesMaskMap* field_value_and_properties_map,
const FormsPredictionsMap* form_predictions) {
SyntheticForm synthetic_form;
synthetic_form.control_elements = form_util::GetUnownedFormFieldElements(
@@ -685,10 +687,10 @@ std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements(
std::unique_ptr<PasswordForm> password_form(new PasswordForm());
UnownedPasswordFormElementsAndFieldSetsToFormData(
synthetic_form.fieldsets, synthetic_form.control_elements, nullptr,
- frame.document(), form_util::EXTRACT_NONE, &password_form->form_data,
- nullptr /* FormFieldData */);
+ frame.document(), field_value_and_properties_map, form_util::EXTRACT_NONE,
+ &password_form->form_data, nullptr /* FormFieldData */);
if (!GetPasswordForm(synthetic_form, password_form.get(),
- nonscript_modified_values, form_predictions))
+ field_value_and_properties_map, form_predictions))
return std::unique_ptr<PasswordForm>();
// No actual action on the form, so use the the origin as the action.

Powered by Google App Engine
This is Rietveld 408576698