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

Unified Diff: components/autofill/core/browser/credit_card_field.cc

Issue 1453193002: autofill: switch autofill_regexes to RE2 library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pattern - ASCII- std::string Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/credit_card_field.cc
diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc
index 3b24ec38c1851268949aaa7ce297cda4ded4c9d8..a7e4cae912350396bc574c313ab0993b2d5a6f76 100644
--- a/components/autofill/core/browser/credit_card_field.cc
+++ b/components/autofill/core/browser/credit_card_field.cc
@@ -40,7 +40,8 @@ bool FindConsecutiveStrings(const std::vector<base::string16>& regex_needles,
for (size_t i = 0; i < haystack.size() - regex_needles.size() + 1; ++i) {
for (size_t j = 0; j < regex_needles.size(); ++j) {
- if (!MatchesPattern(haystack[i + j], regex_needles[j]))
+ if (!MatchesPattern(haystack[i + j],
+ base::UTF16ToASCII(regex_needles[j])))
break;
if (j == regex_needles.size() - 1)
@@ -214,8 +215,7 @@ bool CreditCardField::LikelyCardMonthSelectField(AutofillScanner* scanner) {
return false;
// Filter out years.
- const base::string16 kNumericalYearRe =
- base::ASCIIToUTF16("[1-9][0-9][0-9][0-9]");
+ const char kNumericalYearRe[] = "[1-9][0-9][0-9][0-9]";
for (const auto& value : field->option_values) {
if (MatchesPattern(value, kNumericalYearRe))
return false;
@@ -226,7 +226,7 @@ bool CreditCardField::LikelyCardMonthSelectField(AutofillScanner* scanner) {
}
// Look for numerical months.
- const base::string16 kNumericalMonthRe = base::ASCIIToUTF16("12");
+ const char kNumericalMonthRe[] = "12";
if (MatchesPattern(field->option_values.back(), kNumericalMonthRe) ||
MatchesPattern(field->option_contents.back(), kNumericalMonthRe)) {
return true;

Powered by Google App Engine
This is Rietveld 408576698