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_NAME_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "components/autofill/core/browser/autofill_field.h" | 13 #include "components/autofill/core/browser/autofill_field.h" |
14 #include "components/autofill/core/browser/form_field.h" | 14 #include "components/autofill/core/browser/form_field.h" |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 class AutofillScanner; | 18 class AutofillScanner; |
19 | 19 |
20 // A form field that can parse either a FullNameField or a FirstLastNameField. | 20 // A form field that can parse either a FullNameField or a FirstLastNameField. |
21 class NameField : public FormField { | 21 class NameField : public FormField { |
22 public: | 22 public: |
23 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); | 23 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); |
24 | 24 |
25 protected: | 25 protected: |
26 NameField() {} | 26 NameField() {} |
27 | 27 |
28 // FormField: | 28 // FormField: |
29 bool ClassifyField(ServerFieldTypeMap* map) const override; | 29 bool ClassifyField(ServerFieldTypeMap* map) const override; |
| 30 size_t FieldCount() const override; |
30 | 31 |
31 private: | 32 private: |
32 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast); | 33 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast); |
33 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast2); | 34 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast2); |
34 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast); | 35 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast); |
35 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast2); | 36 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast2); |
36 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastMiddleWithSpaces); | 37 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastMiddleWithSpaces); |
37 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastEmpty); | 38 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastEmpty); |
38 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLastEmpty); | 39 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLastEmpty); |
39 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitial); | 40 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitial); |
40 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitialAtEnd); | 41 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitialAtEnd); |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(NameField); | 43 DISALLOW_COPY_AND_ASSIGN(NameField); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace autofill | 46 } // namespace autofill |
46 | 47 |
47 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ | 48 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ |
OLD | NEW |