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

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

Issue 2148303005: [Password Generation] Sends the flag whether a field has nonempty user input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes addressed to reviewer comments Created 4 years, 4 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
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 14
15 namespace base { 15 namespace base {
16 class Pickle; 16 class Pickle;
17 class PickleIterator; 17 class PickleIterator;
18 } 18 }
19 19
20 namespace autofill { 20 namespace autofill {
21 21
22 // The flags describing form field properties.
23 enum FieldPropertiesFlags {
24 USER_TYPED = 1u << 0,
25 AUTOFILLED = 1u << 1,
26 HAD_FOCUS = 1u << 2,
27 // Use this flag, if some error occurred in flags processing.
28 ERROR_OCCURRED = 1u << 3
29 };
30
31 // FieldPropertiesMask is used to contain combinations of FieldPropertiesFlags
32 // values.
33 typedef uint32_t FieldPropertiesMask;
34
22 // Stores information about a field in a form. 35 // Stores information about a field in a form.
23 struct FormFieldData { 36 struct FormFieldData {
24 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. 37 // Copied to components/autofill/ios/browser/resources/autofill_controller.js.
25 enum RoleAttribute { 38 enum RoleAttribute {
26 // "presentation" 39 // "presentation"
27 ROLE_ATTRIBUTE_PRESENTATION, 40 ROLE_ATTRIBUTE_PRESENTATION,
28 // Anything else. 41 // Anything else.
29 ROLE_ATTRIBUTE_OTHER, 42 ROLE_ATTRIBUTE_OTHER,
30 }; 43 };
31 44
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of 77 // IPC which could span 32 & 64 bit processes. We chose uint64_t instead of
65 // uint32_t to maintain compatibility with old code which used size_t 78 // uint32_t to maintain compatibility with old code which used size_t
66 // (base::Pickle used to serialize that as 64 bit). 79 // (base::Pickle used to serialize that as 64 bit).
67 uint64_t max_length; 80 uint64_t max_length;
68 bool is_autofilled; 81 bool is_autofilled;
69 CheckStatus check_status; 82 CheckStatus check_status;
70 bool is_focusable; 83 bool is_focusable;
71 bool should_autocomplete; 84 bool should_autocomplete;
72 RoleAttribute role; 85 RoleAttribute role;
73 base::i18n::TextDirection text_direction; 86 base::i18n::TextDirection text_direction;
87 FieldPropertiesMask properties_mask;
74 88
75 // For the HTML snippet |<option value="US">United States</option>|, the 89 // For the HTML snippet |<option value="US">United States</option>|, the
76 // value is "US" and the contents are "United States". 90 // value is "US" and the contents are "United States".
77 std::vector<base::string16> option_values; 91 std::vector<base::string16> option_values;
78 std::vector<base::string16> option_contents; 92 std::vector<base::string16> option_contents;
79 }; 93 };
80 94
81 // Serialize and deserialize FormFieldData. These are used when FormData objects 95 // Serialize and deserialize FormFieldData. These are used when FormData objects
82 // are serialized and deserialized. 96 // are serialized and deserialized.
83 void SerializeFormFieldData(const FormFieldData& form_field_data, 97 void SerializeFormFieldData(const FormFieldData& form_field_data,
(...skipping 17 matching lines...) Expand all
101 EXPECT_EQ(expected.label, actual.label); \ 115 EXPECT_EQ(expected.label, actual.label); \
102 EXPECT_EQ(expected.name, actual.name); \ 116 EXPECT_EQ(expected.name, actual.name); \
103 EXPECT_EQ(expected.value, actual.value); \ 117 EXPECT_EQ(expected.value, actual.value); \
104 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \ 118 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \
105 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \ 119 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \
106 EXPECT_EQ(expected.placeholder, actual.placeholder); \ 120 EXPECT_EQ(expected.placeholder, actual.placeholder); \
107 EXPECT_EQ(expected.max_length, actual.max_length); \ 121 EXPECT_EQ(expected.max_length, actual.max_length); \
108 EXPECT_EQ(expected.css_classes, actual.css_classes); \ 122 EXPECT_EQ(expected.css_classes, actual.css_classes); \
109 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ 123 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \
110 EXPECT_EQ(expected.check_status, actual.check_status); \ 124 EXPECT_EQ(expected.check_status, actual.check_status); \
125 EXPECT_EQ(expected.properties_mask, actual.properties_mask); \
111 } while (0) 126 } while (0)
112 127
113 } // namespace autofill 128 } // namespace autofill
114 129
115 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_ 130 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_FIELD_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698