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

Unified Diff: components/autofill/core/common/form_data.cc

Issue 614023002: [Password manager] Relplace the FormFieldData vector from autofill::FormData with named fields… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated review comments. Created 6 years, 2 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/core/common/form_data.cc
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc
index b720ae402ea4b72b049c1ce48df529dabc1c7a2a..d9b1a62a50e4e509c07008fff7f92c2048ec6e43 100644
--- a/components/autofill/core/common/form_data.cc
+++ b/components/autofill/core/common/form_data.cc
@@ -64,6 +64,8 @@ FormData::FormData(const FormData& data)
origin(data.origin),
action(data.action),
user_submitted(data.user_submitted),
+ username_field(data.username_field),
+ password_field(data.password_field),
fields(data.fields) {
}
@@ -71,11 +73,10 @@ FormData::~FormData() {
}
bool FormData::operator==(const FormData& form) const {
- return name == form.name &&
- origin == form.origin &&
- action == form.action &&
+ return name == form.name && origin == form.origin && action == form.action &&
user_submitted == form.user_submitted &&
- fields == form.fields;
+ username_field == form.username_field &&
+ password_field == form.password_field && fields == form.fields;
}
bool FormData::operator!=(const FormData& form) const {
@@ -91,14 +92,17 @@ bool FormData::operator<(const FormData& form) const {
return action < form.action;
if (user_submitted != form.user_submitted)
return user_submitted < form.user_submitted;
+ if (username_field != form.username_field)
+ return username_field < form.username_field;
+ if (password_field != form.password_field)
+ return password_field < form.password_field;
return fields < form.fields;
}
std::ostream& operator<<(std::ostream& os, const FormData& form) {
- os << base::UTF16ToUTF8(form.name) << " "
- << form.origin << " "
- << form.action << " "
- << form.user_submitted << " "
+ os << base::UTF16ToUTF8(form.name) << " " << form.origin << " " << form.action
+ << " " << form.user_submitted << " " << form.username_field << " "
+ << form.password_field << " "
<< "Fields:";
for (size_t i = 0; i < form.fields.size(); ++i) {
os << form.fields[i] << ",";
@@ -112,6 +116,8 @@ void SerializeFormData(const FormData& form_data, Pickle* pickle) {
pickle->WriteString(form_data.origin.spec());
pickle->WriteString(form_data.action.spec());
pickle->WriteBool(form_data.user_submitted);
+ SerializeFormFieldData(form_data.username_field, pickle);
+ SerializeFormFieldData(form_data.password_field, pickle);
SerializeFormFieldDataVector(form_data.fields, pickle);
}
@@ -126,10 +132,11 @@ bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
case 1: {
base::string16 method;
if (!iter->ReadString16(&form_data->name) ||
- !iter->ReadString16(&method) ||
- !ReadGURL(iter, &form_data->origin) ||
+ !iter->ReadString16(&method) || !ReadGURL(iter, &form_data->origin) ||
!ReadGURL(iter, &form_data->action) ||
!iter->ReadBool(&form_data->user_submitted) ||
+ !DeserializeFormFieldData(iter, &form_data->username_field) ||
+ !DeserializeFormFieldData(iter, &form_data->password_field) ||
!DeserializeFormFieldDataVector(iter, &form_data->fields)) {
LogDeserializationError(version);
return false;
@@ -141,6 +148,8 @@ bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
!ReadGURL(iter, &form_data->origin) ||
!ReadGURL(iter, &form_data->action) ||
!iter->ReadBool(&form_data->user_submitted) ||
+ !DeserializeFormFieldData(iter, &form_data->username_field) ||
+ !DeserializeFormFieldData(iter, &form_data->password_field) ||
!DeserializeFormFieldDataVector(iter, &form_data->fields)) {
LogDeserializationError(version);
return false;

Powered by Google App Engine
This is Rietveld 408576698