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_PHONE_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "components/autofill/core/browser/autofill_type.h" | 16 #include "components/autofill/core/browser/autofill_type.h" |
17 #include "components/autofill/core/browser/form_field.h" | 17 #include "components/autofill/core/browser/form_field.h" |
18 #include "components/autofill/core/browser/phone_number.h" | 18 #include "components/autofill/core/browser/phone_number.h" |
19 | 19 |
20 namespace autofill { | 20 namespace autofill { |
21 | 21 |
22 class AutofillField; | 22 class AutofillField; |
23 class AutofillScanner; | 23 class AutofillScanner; |
24 | 24 |
25 // A phone number in one of the following formats: | 25 // A phone number in one of the following formats: |
26 // - area code, prefix, suffix | 26 // - area code, prefix, suffix |
27 // - area code, number | 27 // - area code, number |
28 // - number | 28 // - number |
29 class PhoneField : public FormField { | 29 class PhoneField : public FormField { |
30 public: | 30 public: |
31 ~PhoneField() override; | 31 ~PhoneField() override; |
32 | 32 |
33 static scoped_ptr<FormField> Parse(AutofillScanner* scanner); | 33 static std::unique_ptr<FormField> Parse(AutofillScanner* scanner); |
34 | 34 |
35 protected: | 35 protected: |
36 void AddClassifications(FieldCandidatesMap* field_candidates) const override; | 36 void AddClassifications(FieldCandidatesMap* field_candidates) const override; |
37 | 37 |
38 private: | 38 private: |
39 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseOneLinePhone); | 39 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseOneLinePhone); |
40 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseTwoLinePhone); | 40 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ParseTwoLinePhone); |
41 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumber); | 41 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumber); |
42 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix); | 42 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix); |
43 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2); | 43 FRIEND_TEST_ALL_PREFIXES(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // FIELD_PHONE is always present; holds suffix if prefix is present. | 93 // FIELD_PHONE is always present; holds suffix if prefix is present. |
94 // The rest could be NULL. | 94 // The rest could be NULL. |
95 AutofillField* parsed_phone_fields_[FIELD_MAX]; | 95 AutofillField* parsed_phone_fields_[FIELD_MAX]; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(PhoneField); | 97 DISALLOW_COPY_AND_ASSIGN(PhoneField); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace autofill | 100 } // namespace autofill |
101 | 101 |
102 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ | 102 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ |
OLD | NEW |