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

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

Issue 800543009: autofill: bumped pickle version of FormFieldData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixups Created 5 years, 11 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
« no previous file with comments | « no previous file | components/autofill/core/common/form_field_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/form_field_data.cc
diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc
index 3b80be255c4e99ea5f8e181842b5060e5a7f7336..94c6c7198160bcc15aec8f7d1264495aa2294231 100644
--- a/components/autofill/core/common/form_field_data.cc
+++ b/components/autofill/core/common/form_field_data.cc
@@ -10,7 +10,9 @@
namespace {
-const int kPickleVersion = 1;
+// Increment this anytime pickle format is modified as well as provide
+// deserialization routine from previous kPickleVersion format.
+const int kPickleVersion = 2;
void AddVectorToPickle(std::vector<base::string16> strings,
Pickle* pickle) {
@@ -37,12 +39,12 @@ bool ReadStringVector(PickleIterator* iter,
}
template <typename T>
-bool ReadAsInt(PickleIterator* iter, T* direction) {
+bool ReadAsInt(PickleIterator* iter, T* target_value) {
int pickle_data;
if (!iter->ReadInt(&pickle_data))
return false;
- *direction = static_cast<T>(pickle_data);
+ *target_value = static_cast<T>(pickle_data);
return true;
}
@@ -156,6 +158,26 @@ bool DeserializeFormFieldData(PickleIterator* iter,
!iter->ReadBool(&field_data->is_checkable) ||
!iter->ReadBool(&field_data->is_focusable) ||
!iter->ReadBool(&field_data->should_autocomplete) ||
+ !ReadAsInt(iter, &field_data->text_direction) ||
+ !ReadStringVector(iter, &field_data->option_values) ||
+ !ReadStringVector(iter, &field_data->option_contents)) {
+ LOG(ERROR) << "Could not deserialize FormFieldData from pickle";
+ return false;
+ }
+ break;
+ }
+ case 2: {
+ if (!iter->ReadString16(&field_data->label) ||
+ !iter->ReadString16(&field_data->name) ||
+ !iter->ReadString16(&field_data->value) ||
+ !iter->ReadString(&field_data->form_control_type) ||
+ !iter->ReadString(&field_data->autocomplete_attribute) ||
+ !iter->ReadSizeT(&field_data->max_length) ||
+ !iter->ReadBool(&field_data->is_autofilled) ||
+ !iter->ReadBool(&field_data->is_checked) ||
+ !iter->ReadBool(&field_data->is_checkable) ||
+ !iter->ReadBool(&field_data->is_focusable) ||
+ !iter->ReadBool(&field_data->should_autocomplete) ||
!ReadAsInt(iter, &field_data->role) ||
Lei Zhang 2015/01/23 06:43:01 I wish you put "role" at the end, so (de)serializi
!ReadAsInt(iter, &field_data->text_direction) ||
!ReadStringVector(iter, &field_data->option_values) ||
« no previous file with comments | « no previous file | components/autofill/core/common/form_field_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698