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 #include "components/autofill/core/browser/phone_field.h" | 5 #include "components/autofill/core/browser/phone_field.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 118 }; |
119 | 119 |
120 // static | 120 // static |
121 FormField* PhoneField::Parse(AutofillScanner* scanner) { | 121 FormField* PhoneField::Parse(AutofillScanner* scanner) { |
122 if (scanner->IsEnd()) | 122 if (scanner->IsEnd()) |
123 return NULL; | 123 return NULL; |
124 | 124 |
125 scanner->SaveCursor(); | 125 scanner->SaveCursor(); |
126 | 126 |
127 // The form owns the following variables, so they should not be deleted. | 127 // The form owns the following variables, so they should not be deleted. |
128 const AutofillField* parsed_fields[FIELD_MAX]; | 128 AutofillField* parsed_fields[FIELD_MAX]; |
129 | 129 |
130 for (size_t i = 0; i < arraysize(kPhoneFieldGrammars); ++i) { | 130 for (size_t i = 0; i < arraysize(kPhoneFieldGrammars); ++i) { |
131 memset(parsed_fields, 0, sizeof(parsed_fields)); | 131 memset(parsed_fields, 0, sizeof(parsed_fields)); |
132 scanner->SaveCursor(); | 132 scanner->SaveCursor(); |
133 | 133 |
134 // Attempt to parse according to the next grammar. | 134 // Attempt to parse according to the next grammar. |
135 for (; i < arraysize(kPhoneFieldGrammars) && | 135 for (; i < arraysize(kPhoneFieldGrammars) && |
136 kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR; ++i) { | 136 kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR; ++i) { |
137 if (!ParseFieldSpecifics( | 137 if (!ParseFieldSpecifics( |
138 scanner, | 138 scanner, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 case REGEX_EXTENSION: | 267 case REGEX_EXTENSION: |
268 return base::UTF8ToUTF16(autofill::kPhoneExtensionRe); | 268 return base::UTF8ToUTF16(autofill::kPhoneExtensionRe); |
269 default: | 269 default: |
270 NOTREACHED(); | 270 NOTREACHED(); |
271 break; | 271 break; |
272 } | 272 } |
273 return base::string16(); | 273 return base::string16(); |
274 } | 274 } |
275 | 275 |
276 } // namespace autofill | 276 } // namespace autofill |
OLD | NEW |