Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 // Stores information about a field in a form. | 22 // Stores information about a field in a form. |
| 23 struct FormFieldData { | 23 struct FormFieldData { |
| 24 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. | 24 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. |
| 25 enum RoleAttribute { | 25 enum RoleAttribute { |
| 26 // "presentation" | 26 // "presentation" |
| 27 ROLE_ATTRIBUTE_PRESENTATION, | 27 ROLE_ATTRIBUTE_PRESENTATION, |
| 28 // Anything else. | 28 // Anything else. |
| 29 ROLE_ATTRIBUTE_OTHER, | 29 ROLE_ATTRIBUTE_OTHER, |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 enum CheckStatus { | |
|
vabr (Chromium)
2016/05/31 15:48:25
Please use enum class instead of enum, to get bett
Hwanseung Lee(hs1217.lee)
2016/06/09 15:41:59
if enum class used instead of enum, it is complex
| |
| 33 CHECK_STATUS_NOT_CHECKABLE, | |
| 34 CHECK_STATUS_CHECKABLE_BUT_UNCHECKED, | |
| 35 CHECK_STATUS_CHECKED, | |
| 36 }; | |
| 37 | |
| 32 FormFieldData(); | 38 FormFieldData(); |
| 33 FormFieldData(const FormFieldData& other); | 39 FormFieldData(const FormFieldData& other); |
| 34 ~FormFieldData(); | 40 ~FormFieldData(); |
| 35 | 41 |
| 36 // Returns true if two form fields are the same, not counting the value. | 42 // Returns true if two form fields are the same, not counting the value. |
| 37 bool SameFieldAs(const FormFieldData& field) const; | 43 bool SameFieldAs(const FormFieldData& field) const; |
| 38 | 44 |
| 39 // Comparison operator exposed for STL map. Uses label, then name to sort. | 45 // Comparison operator exposed for STL map. Uses label, then name to sort. |
| 40 bool operator<(const FormFieldData& field) const; | 46 bool operator<(const FormFieldData& field) const; |
| 41 | 47 |
| 42 // If you add more, be sure to update the comparison operator, SameFieldAs, | 48 // If you add more, be sure to update the comparison operator, SameFieldAs, |
| 43 // serializing functions (in the .cc file) and the constructor. | 49 // serializing functions (in the .cc file) and the constructor. |
| 44 base::string16 label; | 50 base::string16 label; |
| 45 base::string16 name; | 51 base::string16 name; |
| 46 base::string16 value; | 52 base::string16 value; |
| 47 std::string form_control_type; | 53 std::string form_control_type; |
| 48 std::string autocomplete_attribute; | 54 std::string autocomplete_attribute; |
| 49 base::string16 placeholder; | 55 base::string16 placeholder; |
| 50 // Note: we use uint64_t instead of size_t because this struct is sent over | 56 // Note: we use uint64_t instead of size_t because this struct is sent over |
| 51 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of | 57 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of |
| 52 // uint32_t to maintain compatibility with old code which used size_t | 58 // uint32_t to maintain compatibility with old code which used size_t |
| 53 // (base::Pickle used to serialize that as 64 bit). | 59 // (base::Pickle used to serialize that as 64 bit). |
| 54 uint64_t max_length; | 60 uint64_t max_length; |
| 55 bool is_autofilled; | 61 bool is_autofilled; |
| 56 bool is_checked; | 62 CheckStatus check_status; |
| 57 bool is_checkable; | |
| 58 bool is_focusable; | 63 bool is_focusable; |
| 59 bool should_autocomplete; | 64 bool should_autocomplete; |
| 60 RoleAttribute role; | 65 RoleAttribute role; |
| 61 base::i18n::TextDirection text_direction; | 66 base::i18n::TextDirection text_direction; |
| 62 | 67 |
| 63 // For the HTML snippet |<option value="US">United States</option>|, the | 68 // For the HTML snippet |<option value="US">United States</option>|, the |
| 64 // value is "US" and the contents are "United States". | 69 // value is "US" and the contents are "United States". |
| 65 std::vector<base::string16> option_values; | 70 std::vector<base::string16> option_values; |
| 66 std::vector<base::string16> option_contents; | 71 std::vector<base::string16> option_contents; |
| 67 }; | 72 }; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 88 EXPECT_EQ(expected.placeholder, actual.placeholder); \ | 93 EXPECT_EQ(expected.placeholder, actual.placeholder); \ |
| 89 EXPECT_EQ(expected.max_length, actual.max_length); \ | 94 EXPECT_EQ(expected.max_length, actual.max_length); \ |
| 90 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ | 95 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ |
| 91 EXPECT_EQ(expected.is_checked, actual.is_checked); \ | 96 EXPECT_EQ(expected.is_checked, actual.is_checked); \ |
| 92 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \ | 97 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \ |
| 93 } while (0) | 98 } while (0) |
| 94 | 99 |
| 95 } // namespace autofill | 100 } // namespace autofill |
| 96 | 101 |
| 97 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ | 102 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ |
| OLD | NEW |