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

Unified Diff: components/password_manager/core/browser/password_form_manager.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: Fixed a typo 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/password_manager/core/browser/password_form_manager.cc
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index 272699e0b163ecea95e3f9760e5283ecae5aac95..cb39586bb887357910763c82ca470683c6882c74 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -159,6 +159,20 @@ void SanitizePossibleUsernames(PasswordForm* form) {
usernames.erase(new_end, usernames.end());
}
+// Copies field properties masks from the form |from| to the form |to|.
+void CopyFieldPropertiesMasks(const PasswordForm& from, PasswordForm* to) {
+ // Skip copying if the number of fields is different.
+ if (from.form_data.fields.size() != to->form_data.fields.size())
+ return;
+
+ for (size_t i = 0; i < from.form_data.fields.size(); ++i) {
+ to->form_data.fields[i].properties_mask =
+ to->form_data.fields[i].name == from.form_data.fields[i].name
+ ? from.form_data.fields[i].properties_mask
+ : autofill::FieldPropertiesFlags::ERROR_OCCURRED;
+ }
+}
+
} // namespace
PasswordFormManager::PasswordFormManager(
@@ -1063,6 +1077,7 @@ void PasswordFormManager::CreatePendingCredentials() {
pending_credentials_.password_value = password_to_save;
pending_credentials_.preferred = provisionally_saved_form_->preferred;
+ CopyFieldPropertiesMasks(*provisionally_saved_form_, &pending_credentials_);
// If we're dealing with an API-driven provisionally saved form, then take
// the server provided values. We don't do this for non-API forms, as

Powered by Google App Engine
This is Rietveld 408576698