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_BROWSER_FORM_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Attempts to parse a field with an empty label. Returns true | 77 // Attempts to parse a field with an empty label. Returns true |
78 // on success and fills |match| with a pointer to the field. | 78 // on success and fills |match| with a pointer to the field. |
79 static bool ParseEmptyLabel(AutofillScanner* scanner, AutofillField** match); | 79 static bool ParseEmptyLabel(AutofillScanner* scanner, AutofillField** match); |
80 | 80 |
81 // Adds an association between a field and a type to |map|. | 81 // Adds an association between a field and a type to |map|. |
82 static bool AddClassification(const AutofillField* field, | 82 static bool AddClassification(const AutofillField* field, |
83 ServerFieldType type, | 83 ServerFieldType type, |
84 ServerFieldTypeMap* map); | 84 ServerFieldTypeMap* map); |
85 | 85 |
| 86 // Returns true iff |type| matches |match_type|. |
| 87 static bool MatchesFormControlType(const std::string& type, int match_type); |
| 88 |
86 // Derived classes must implement this interface to supply field type | 89 // Derived classes must implement this interface to supply field type |
87 // information. |ParseFormFields| coordinates the parsing and extraction | 90 // information. |ParseFormFields| coordinates the parsing and extraction |
88 // of types from an input vector of |AutofillField| objects and delegates | 91 // of types from an input vector of |AutofillField| objects and delegates |
89 // the type extraction via this method. | 92 // the type extraction via this method. |
90 virtual bool ClassifyField(ServerFieldTypeMap* map) const = 0; | 93 virtual bool ClassifyField(ServerFieldTypeMap* map) const = 0; |
91 | 94 |
92 private: | 95 private: |
93 FRIEND_TEST_ALL_PREFIXES(FormFieldTest, Match); | 96 FRIEND_TEST_ALL_PREFIXES(FormFieldTest, Match); |
94 | 97 |
95 // Function pointer type for the parsing function that should be passed to the | 98 // Function pointer type for the parsing function that should be passed to the |
(...skipping 17 matching lines...) Expand all Loading... |
113 | 116 |
114 // Perform a "pass" over the |fields| where each pass uses the supplied | 117 // Perform a "pass" over the |fields| where each pass uses the supplied |
115 // |parse| method to match content to a given field type. | 118 // |parse| method to match content to a given field type. |
116 // |fields| is both an input and an output parameter. Upon exit |fields| | 119 // |fields| is both an input and an output parameter. Upon exit |fields| |
117 // holds any remaining unclassified fields for further processing. | 120 // holds any remaining unclassified fields for further processing. |
118 // Classification results of the processed fields are stored in |map|. | 121 // Classification results of the processed fields are stored in |map|. |
119 static void ParseFormFieldsPass(ParseFunction parse, | 122 static void ParseFormFieldsPass(ParseFunction parse, |
120 std::vector<AutofillField*>* fields, | 123 std::vector<AutofillField*>* fields, |
121 ServerFieldTypeMap* map); | 124 ServerFieldTypeMap* map); |
122 | 125 |
123 // Returns true iff |type| matches |match_type|. | |
124 static bool MatchesFormControlType(const std::string& type, int match_type); | |
125 | |
126 DISALLOW_COPY_AND_ASSIGN(FormField); | 126 DISALLOW_COPY_AND_ASSIGN(FormField); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace autofill | 129 } // namespace autofill |
130 | 130 |
131 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ | 131 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ |
OLD | NEW |