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

Side by Side Diff: components/autofill/core/browser/credit_card.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/credit_card.h" 5 #include "components/autofill/core/browser/credit_card.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <ostream> 10 #include <ostream>
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 formatted_date.append(base::ASCIIToUTF16("/")); 437 formatted_date.append(base::ASCIIToUTF16("/"));
438 formatted_date.append(Expiration4DigitYearAsString()); 438 formatted_date.append(Expiration4DigitYearAsString());
439 439
440 base::string16 separator = 440 base::string16 separator =
441 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR); 441 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR);
442 return std::make_pair(obfuscated_cc_number, separator + formatted_date); 442 return std::make_pair(obfuscated_cc_number, separator + formatted_date);
443 } 443 }
444 444
445 void CreditCard::SetInfoForMonthInputType(const base::string16& value) { 445 void CreditCard::SetInfoForMonthInputType(const base::string16& value) {
446 // Check if |text| is "yyyy-mm" format first, and check normal month format. 446 // Check if |text| is "yyyy-mm" format first, and check normal month format.
447 if (!MatchesPattern(value, base::UTF8ToUTF16("^[0-9]{4}-[0-9]{1,2}$"))) 447 if (!MatchesPattern(value, "^[0-9]{4}-[0-9]{1,2}$"))
448 return; 448 return;
449 449
450 std::vector<base::StringPiece16> year_month = base::SplitStringPiece( 450 std::vector<base::StringPiece16> year_month = base::SplitStringPiece(
451 value, base::ASCIIToUTF16("-"), 451 value, base::ASCIIToUTF16("-"),
452 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 452 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
453 DCHECK_EQ(2u, year_month.size()); 453 DCHECK_EQ(2u, year_month.size());
454 int num = 0; 454 int num = 0;
455 bool converted = false; 455 bool converted = false;
456 converted = base::StringToInt(year_month[0], &num); 456 converted = base::StringToInt(year_month[0], &num);
457 DCHECK(converted); 457 DCHECK(converted);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 const char kAmericanExpressCard[] = "americanExpressCC"; 788 const char kAmericanExpressCard[] = "americanExpressCC";
789 const char kDinersCard[] = "dinersCC"; 789 const char kDinersCard[] = "dinersCC";
790 const char kDiscoverCard[] = "discoverCC"; 790 const char kDiscoverCard[] = "discoverCC";
791 const char kGenericCard[] = "genericCC"; 791 const char kGenericCard[] = "genericCC";
792 const char kJCBCard[] = "jcbCC"; 792 const char kJCBCard[] = "jcbCC";
793 const char kMasterCard[] = "masterCardCC"; 793 const char kMasterCard[] = "masterCardCC";
794 const char kUnionPay[] = "unionPayCC"; 794 const char kUnionPay[] = "unionPayCC";
795 const char kVisaCard[] = "visaCC"; 795 const char kVisaCard[] = "visaCC";
796 796
797 } // namespace autofill 797 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698