Chromium Code Reviews| 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 83d8173ace00f9c67b7a8689f826fc1e13a05cff..8eadba5b32db0f72d7a45c64ef9450e6aa8f7928 100644 |
| --- a/components/autofill/core/common/form_data.cc |
| +++ b/components/autofill/core/common/form_data.cc |
| @@ -13,7 +13,7 @@ namespace autofill { |
| namespace { |
| -const int kPickleVersion = 1; |
| +const int kPickleVersion = 2; |
| bool ReadGURL(PickleIterator* iter, GURL* url) { |
| std::string spec; |
| @@ -48,6 +48,11 @@ bool DeserializeFormFieldDataVector(PickleIterator* iter, |
| return true; |
| } |
| +void LogDeserializationError(int version) { |
| + LOG(ERROR) << "Could not deserialize version " << version |
| + << " FormData from pickle."; |
|
Ilya Sherman
2014/08/07 19:23:31
nit: Please use DVLOG(1) here. (I do see that the
|
| +} |
| + |
| } // namespace |
| FormData::FormData() |
| @@ -116,15 +121,27 @@ bool DeserializeFormData(PickleIterator* iter, FormData* form_data) { |
| LOG(ERROR) << "Bad pickle of FormData, no version present"; |
| return false; |
| } |
| - |
|
Ilya Sherman
2014/08/07 19:23:31
nit: Please preserve this newline.
|
| switch (version) { |
| case 1: { |
| + base::string16 method; |
| + if (!iter->ReadString16(&form_data->name) || |
| + !iter->ReadString16(&method) || |
| + !ReadGURL(iter, &form_data->origin) || |
| + !ReadGURL(iter, &form_data->action) || |
| + !iter->ReadBool(&form_data->user_submitted) || |
| + !DeserializeFormFieldDataVector(iter, &form_data->fields)) { |
| + LogDeserializationError(version); |
| + return false; |
| + } |
| + break; |
| + } |
| + case 2: { |
| if (!iter->ReadString16(&form_data->name) || |
| !ReadGURL(iter, &form_data->origin) || |
| !ReadGURL(iter, &form_data->action) || |
| !iter->ReadBool(&form_data->user_submitted) || |
| !DeserializeFormFieldDataVector(iter, &form_data->fields)) { |
| - LOG(ERROR) << "Could not deserialize FormData from pickle"; |
| + LogDeserializationError(version); |
| return false; |
| } |
| break; |