OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/credit_card.h" | 5 #include "chrome/browser/autofill/credit_card.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/autofill/autofill_scanner.h" | 17 #include "chrome/browser/autofill/autofill_regexes.h" |
18 #include "chrome/browser/autofill/autofill_type.h" | 18 #include "chrome/browser/autofill/autofill_type.h" |
19 #include "chrome/browser/autofill/field_types.h" | 19 #include "chrome/browser/autofill/field_types.h" |
20 #include "chrome/common/guid.h" | 20 #include "chrome/common/guid.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char16 kCreditCardObfuscationSymbol = '*'; | 26 const char16 kCreditCardObfuscationSymbol = '*'; |
27 | 27 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 formatted_date.append(Expiration4DigitYearAsString()); | 313 formatted_date.append(Expiration4DigitYearAsString()); |
314 | 314 |
315 label = l10n_util::GetStringFUTF16(IDS_CREDIT_CARD_NUMBER_PREVIEW_FORMAT, | 315 label = l10n_util::GetStringFUTF16(IDS_CREDIT_CARD_NUMBER_PREVIEW_FORMAT, |
316 obfuscated_cc_number, | 316 obfuscated_cc_number, |
317 formatted_date); | 317 formatted_date); |
318 return label; | 318 return label; |
319 } | 319 } |
320 | 320 |
321 void CreditCard::SetInfoForMonthInputType(const string16& value) { | 321 void CreditCard::SetInfoForMonthInputType(const string16& value) { |
322 // Check if |text| is "yyyy-mm" format first, and check normal month format. | 322 // Check if |text| is "yyyy-mm" format first, and check normal month format. |
323 if (!autofill::MatchString(value, UTF8ToUTF16("^[0-9]{4}-[0-9]{1,2}$"))) | 323 if (!autofill::MatchesPattern(value, UTF8ToUTF16("^[0-9]{4}-[0-9]{1,2}$"))) |
324 return; | 324 return; |
325 | 325 |
326 std::vector<string16> year_month; | 326 std::vector<string16> year_month; |
327 base::SplitString(value, L'-', &year_month); | 327 base::SplitString(value, L'-', &year_month); |
328 DCHECK_EQ((int)year_month.size(), 2); | 328 DCHECK_EQ((int)year_month.size(), 2); |
329 int num = 0; | 329 int num = 0; |
330 bool converted = false; | 330 bool converted = false; |
331 converted = base::StringToInt(year_month[0], &num); | 331 converted = base::StringToInt(year_month[0], &num); |
332 DCHECK(converted); | 332 DCHECK(converted); |
333 SetExpirationYear(num); | 333 SetExpirationYear(num); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // send these strings to WK, which then asks WebKitClientImpl to load the image | 571 // send these strings to WK, which then asks WebKitClientImpl to load the image |
572 // data. | 572 // data. |
573 const char* const kAmericanExpressCard = "americanExpressCC"; | 573 const char* const kAmericanExpressCard = "americanExpressCC"; |
574 const char* const kDinersCard = "dinersCC"; | 574 const char* const kDinersCard = "dinersCC"; |
575 const char* const kDiscoverCard = "discoverCC"; | 575 const char* const kDiscoverCard = "discoverCC"; |
576 const char* const kGenericCard = "genericCC"; | 576 const char* const kGenericCard = "genericCC"; |
577 const char* const kJCBCard = "jcbCC"; | 577 const char* const kJCBCard = "jcbCC"; |
578 const char* const kMasterCard = "masterCardCC"; | 578 const char* const kMasterCard = "masterCardCC"; |
579 const char* const kSoloCard = "soloCC"; | 579 const char* const kSoloCard = "soloCC"; |
580 const char* const kVisaCard = "visaCC"; | 580 const char* const kVisaCard = "visaCC"; |
OLD | NEW |