Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: components/autofill/core/browser/phone_field.cc

Issue 1453193002: autofill: switch autofill_regexes to RE2 library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reviews Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/strings/utf_string_conversions.h"
12 #include "components/autofill/core/browser/autofill_field.h" 11 #include "components/autofill/core/browser/autofill_field.h"
13 #include "components/autofill/core/browser/autofill_regex_constants.h" 12 #include "components/autofill/core/browser/autofill_regex_constants.h"
14 #include "components/autofill/core/browser/autofill_scanner.h" 13 #include "components/autofill/core/browser/autofill_scanner.h"
15 14
16 namespace autofill { 15 namespace autofill {
17 namespace { 16 namespace {
18 17
19 // This string includes all area code separators, including NoText. 18 // This string includes all area code separators, including NoText.
20 std::string GetAreaRegex() { 19 std::string GetAreaRegex() {
21 std::string area_code = kAreaCodeRe; 20 std::string area_code = kAreaCodeRe;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 NOTREACHED(); 268 NOTREACHED();
270 break; 269 break;
271 } 270 }
272 return std::string(); 271 return std::string();
273 } 272 }
274 273
275 // static 274 // static
276 bool PhoneField::ParsePhoneField(AutofillScanner* scanner, 275 bool PhoneField::ParsePhoneField(AutofillScanner* scanner,
277 const std::string& regex, 276 const std::string& regex,
278 AutofillField** field) { 277 AutofillField** field) {
279 return ParseFieldSpecifics(scanner, 278 return ParseFieldSpecifics(
280 base::UTF8ToUTF16(regex), 279 scanner, regex, MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER, field);
281 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER,
282 field);
283 } 280 }
284 281
285 } // namespace autofill 282 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698