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 <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "components/autofill/core/browser/field_candidates.h" | 14 #include "components/autofill/core/browser/field_candidates.h" |
15 #include "components/autofill/core/browser/field_types.h" | 15 #include "components/autofill/core/browser/field_types.h" |
16 | 16 |
17 namespace autofill { | 17 namespace autofill { |
18 | 18 |
19 class AutofillField; | 19 class AutofillField; |
20 class AutofillScanner; | 20 class AutofillScanner; |
21 | 21 |
22 // Represents a logical form field in a web form. Classes that implement this | 22 // Represents a logical form field in a web form. Classes that implement this |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // of types from an input vector of |AutofillField| objects and delegates | 102 // of types from an input vector of |AutofillField| objects and delegates |
103 // the type extraction via this method. | 103 // the type extraction via this method. |
104 virtual void AddClassifications( | 104 virtual void AddClassifications( |
105 FieldCandidatesMap* field_candidates) const = 0; | 105 FieldCandidatesMap* field_candidates) const = 0; |
106 | 106 |
107 private: | 107 private: |
108 FRIEND_TEST_ALL_PREFIXES(FormFieldTest, Match); | 108 FRIEND_TEST_ALL_PREFIXES(FormFieldTest, Match); |
109 | 109 |
110 // Function pointer type for the parsing function that should be passed to the | 110 // Function pointer type for the parsing function that should be passed to the |
111 // ParseFormFieldsPass() helper function. | 111 // ParseFormFieldsPass() helper function. |
112 typedef scoped_ptr<FormField> ParseFunction(AutofillScanner* scanner); | 112 typedef std::unique_ptr<FormField> ParseFunction(AutofillScanner* scanner); |
113 | 113 |
114 // Matches |pattern| to the contents of the field at the head of the | 114 // Matches |pattern| to the contents of the field at the head of the |
115 // |scanner|. | 115 // |scanner|. |
116 // Returns |true| if a match is found according to |match_type|, and |false| | 116 // Returns |true| if a match is found according to |match_type|, and |false| |
117 // otherwise. | 117 // otherwise. |
118 static bool MatchAndAdvance(AutofillScanner* scanner, | 118 static bool MatchAndAdvance(AutofillScanner* scanner, |
119 const base::string16& pattern, | 119 const base::string16& pattern, |
120 int match_type, | 120 int match_type, |
121 AutofillField** match); | 121 AutofillField** match); |
122 | 122 |
(...skipping 12 matching lines...) Expand all Loading... |
135 static void ParseFormFieldsPass(ParseFunction parse, | 135 static void ParseFormFieldsPass(ParseFunction parse, |
136 const std::vector<AutofillField*>& fields, | 136 const std::vector<AutofillField*>& fields, |
137 FieldCandidatesMap* field_candidates); | 137 FieldCandidatesMap* field_candidates); |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(FormField); | 139 DISALLOW_COPY_AND_ASSIGN(FormField); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace autofill | 142 } // namespace autofill |
143 | 143 |
144 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ | 144 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_FIELD_H_ |
OLD | NEW |