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