| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Comparison operator exposed for STL map. Uses label, then name to sort. | 39 // Comparison operator exposed for STL map. Uses label, then name to sort. |
| 40 bool operator<(const FormFieldData& field) const; | 40 bool operator<(const FormFieldData& field) const; |
| 41 | 41 |
| 42 // If you add more, be sure to update the comparison operator, SameFieldAs, | 42 // If you add more, be sure to update the comparison operator, SameFieldAs, |
| 43 // serializing functions (in the .cc file) and the constructor. | 43 // serializing functions (in the .cc file) and the constructor. |
| 44 base::string16 label; | 44 base::string16 label; |
| 45 base::string16 name; | 45 base::string16 name; |
| 46 base::string16 value; | 46 base::string16 value; |
| 47 std::string form_control_type; | 47 std::string form_control_type; |
| 48 std::string autocomplete_attribute; | 48 std::string autocomplete_attribute; |
| 49 base::string16 placeholder; |
| 49 // Note: we use uint64_t instead of size_t because this struct is sent over | 50 // Note: we use uint64_t instead of size_t because this struct is sent over |
| 50 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of | 51 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of |
| 51 // uint32_t to maintain compatibility with old code which used size_t | 52 // uint32_t to maintain compatibility with old code which used size_t |
| 52 // (base::Pickle used to serialize that as 64 bit). | 53 // (base::Pickle used to serialize that as 64 bit). |
| 53 uint64_t max_length; | 54 uint64_t max_length; |
| 54 bool is_autofilled; | 55 bool is_autofilled; |
| 55 bool is_checked; | 56 bool is_checked; |
| 56 bool is_checkable; | 57 bool is_checkable; |
| 57 bool is_focusable; | 58 bool is_focusable; |
| 58 bool should_autocomplete; | 59 bool should_autocomplete; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 void SerializeFormFieldData(const FormFieldData& form_field_data, | 71 void SerializeFormFieldData(const FormFieldData& form_field_data, |
| 71 base::Pickle* serialized); | 72 base::Pickle* serialized); |
| 72 bool DeserializeFormFieldData(base::PickleIterator* pickle_iterator, | 73 bool DeserializeFormFieldData(base::PickleIterator* pickle_iterator, |
| 73 FormFieldData* form_field_data); | 74 FormFieldData* form_field_data); |
| 74 | 75 |
| 75 // So we can compare FormFieldDatas with EXPECT_EQ(). | 76 // So we can compare FormFieldDatas with EXPECT_EQ(). |
| 76 std::ostream& operator<<(std::ostream& os, const FormFieldData& field); | 77 std::ostream& operator<<(std::ostream& os, const FormFieldData& field); |
| 77 | 78 |
| 78 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing | 79 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing |
| 79 // |FormFieldData|s in test code. | 80 // |FormFieldData|s in test code. |
| 80 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ | 81 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ |
| 81 do { \ | 82 do { \ |
| 82 EXPECT_EQ(expected.label, actual.label); \ | 83 EXPECT_EQ(expected.label, actual.label); \ |
| 83 EXPECT_EQ(expected.name, actual.name); \ | 84 EXPECT_EQ(expected.name, actual.name); \ |
| 84 EXPECT_EQ(expected.value, actual.value); \ | 85 EXPECT_EQ(expected.value, actual.value); \ |
| 85 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ | 86 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ |
| 86 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ | 87 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ |
| 87 EXPECT_EQ(expected.max_length, actual.max_length); \ | 88 EXPECT_EQ(expected.placeholder, actual.placeholder); \ |
| 88 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ | 89 EXPECT_EQ(expected.max_length, actual.max_length); \ |
| 89 EXPECT_EQ(expected.is_checked, actual.is_checked); \ | 90 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ |
| 90 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \ | 91 EXPECT_EQ(expected.is_checked, actual.is_checked); \ |
| 92 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \ |
| 91 } while (0) | 93 } while (0) |
| 92 | 94 |
| 93 } // namespace autofill | 95 } // namespace autofill |
| 94 | 96 |
| 95 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 97 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
| OLD | NEW |