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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 struct Parser { | 72 struct Parser { |
73 RegexType regex; // Field matching reg-ex. | 73 RegexType regex; // Field matching reg-ex. |
74 PhonePart phone_part; // Index of the field. | 74 PhonePart phone_part; // Index of the field. |
75 size_t max_size; // Max size of the field to match. 0 means any. | 75 size_t max_size; // Max size of the field to match. 0 means any. |
76 }; | 76 }; |
77 | 77 |
78 static const Parser kPhoneFieldGrammars[]; | 78 static const Parser kPhoneFieldGrammars[]; |
79 | 79 |
80 PhoneField(); | 80 PhoneField(); |
81 | 81 |
82 // Returns the regular expression string correspoding to |regex_id| | 82 // Returns the regular expression string corresponding to |regex_id| |
83 static base::string16 GetRegExp(RegexType regex_id); | 83 static std::string GetRegExp(RegexType regex_id); |
| 84 |
| 85 // Convenient wrapper for ParseFieldSpecifics(). |
| 86 static bool ParsePhoneField(AutofillScanner* scanner, |
| 87 const std::string& regex, |
| 88 AutofillField** field); |
84 | 89 |
85 // FIELD_PHONE is always present; holds suffix if prefix is present. | 90 // FIELD_PHONE is always present; holds suffix if prefix is present. |
86 // The rest could be NULL. | 91 // The rest could be NULL. |
87 AutofillField* parsed_phone_fields_[FIELD_MAX]; | 92 AutofillField* parsed_phone_fields_[FIELD_MAX]; |
88 | 93 |
89 DISALLOW_COPY_AND_ASSIGN(PhoneField); | 94 DISALLOW_COPY_AND_ASSIGN(PhoneField); |
90 }; | 95 }; |
91 | 96 |
92 } // namespace autofill | 97 } // namespace autofill |
93 | 98 |
94 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ | 99 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PHONE_FIELD_H_ |
OLD | NEW |