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

Side by Side Diff: components/autofill/core/common/form_field_data.h

Issue 23033010: [password autofill] Add serialization for FormData and FormFieldData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 12
13 class Pickle;
14 class PickleIterator;
15
13 namespace autofill { 16 namespace autofill {
14 17
15 // Stores information about a field in a form. 18 // Stores information about a field in a form.
16 struct FormFieldData { 19 struct FormFieldData {
17 FormFieldData(); 20 FormFieldData();
18 ~FormFieldData(); 21 ~FormFieldData();
19 22
20 // Equality tests for identity which does not include |value| or 23 // Equality tests for identity which does not include |value| or
21 // |is_autofilled|. 24 // |is_autofilled|.
22 // TODO(dhollowa): These operators need to be revised when we implement field 25 // TODO(dhollowa): These operators need to be revised when we implement field
(...skipping 15 matching lines...) Expand all
38 bool is_focusable; 41 bool is_focusable;
39 bool should_autocomplete; 42 bool should_autocomplete;
40 base::i18n::TextDirection text_direction; 43 base::i18n::TextDirection text_direction;
41 44
42 // For the HTML snippet |<option value="US">United States</option>|, the 45 // For the HTML snippet |<option value="US">United States</option>|, the
43 // value is "US" and the contents are "United States". 46 // value is "US" and the contents are "United States".
44 std::vector<base::string16> option_values; 47 std::vector<base::string16> option_values;
45 std::vector<base::string16> option_contents; 48 std::vector<base::string16> option_contents;
46 }; 49 };
47 50
51 // Serialize and deserialize FormFieldData. These are used when FormData objects
52 // are serialized and deserialized.
53 void SerializeFormFieldData(const FormFieldData& form_field_data,
54 Pickle* serialized);
55 bool DeserializeFormFieldData(PickleIterator* pickle_iterator,
56 FormFieldData* form_field_data);
57
48 // So we can compare FormFieldDatas with EXPECT_EQ(). 58 // So we can compare FormFieldDatas with EXPECT_EQ().
49 std::ostream& operator<<(std::ostream& os, const FormFieldData& field); 59 std::ostream& operator<<(std::ostream& os, const FormFieldData& field);
50 60
51 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing 61 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing
52 // |FormFieldData|s in test code. 62 // |FormFieldData|s in test code.
53 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ 63 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \
54 do { \ 64 do { \
55 EXPECT_EQ(expected.label, actual.label); \ 65 EXPECT_EQ(expected.label, actual.label); \
56 EXPECT_EQ(expected.name, actual.name); \ 66 EXPECT_EQ(expected.name, actual.name); \
57 EXPECT_EQ(expected.value, actual.value); \ 67 EXPECT_EQ(expected.value, actual.value); \
58 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ 68 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \
59 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ 69 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \
60 EXPECT_EQ(expected.max_length, actual.max_length); \ 70 EXPECT_EQ(expected.max_length, actual.max_length); \
61 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ 71 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \
62 EXPECT_EQ(expected.is_checked, actual.is_checked); \ 72 EXPECT_EQ(expected.is_checked, actual.is_checked); \
63 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \ 73 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \
64 } while (0) 74 } while (0)
65 75
66 } // namespace autofill 76 } // namespace autofill
67 77
68 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ 78 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_
69
OLDNEW
« no previous file with comments | « components/autofill/core/common/form_data_unittest.cc ('k') | components/autofill/core/common/form_field_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698