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/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 <ostream> | 9 #include <ostream> |
10 #include <string> | 10 #include <string> |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 break; | 364 break; |
365 | 365 |
366 default: | 366 default: |
367 NOTREACHED() << "Attempting to set unknown info-type " << type; | 367 NOTREACHED() << "Attempting to set unknown info-type " << type; |
368 break; | 368 break; |
369 } | 369 } |
370 } | 370 } |
371 | 371 |
372 base::string16 CreditCard::GetInfo(const AutofillType& type, | 372 base::string16 CreditCard::GetInfo(const AutofillType& type, |
373 const std::string& app_locale) const { | 373 const std::string& app_locale) const { |
374 if (type.native_type() == CREDIT_CARD_NUMBER) | 374 NativeFieldType native_type = type.GetEquivalentNativeType(); |
| 375 if (native_type == CREDIT_CARD_NUMBER) |
375 return StripSeparators(number_); | 376 return StripSeparators(number_); |
376 | 377 |
377 return GetRawInfo(type.native_type()); | 378 return GetRawInfo(native_type); |
378 } | 379 } |
379 | 380 |
380 bool CreditCard::SetInfo(const AutofillType& type, | 381 bool CreditCard::SetInfo(const AutofillType& type, |
381 const base::string16& value, | 382 const base::string16& value, |
382 const std::string& app_locale) { | 383 const std::string& app_locale) { |
383 NativeFieldType native_type = type.native_type(); | 384 NativeFieldType native_type = type.GetEquivalentNativeType(); |
384 if (native_type == CREDIT_CARD_NUMBER) | 385 if (native_type == CREDIT_CARD_NUMBER) |
385 SetRawInfo(native_type, StripSeparators(value)); | 386 SetRawInfo(native_type, StripSeparators(value)); |
386 else if (native_type == CREDIT_CARD_EXP_MONTH) | 387 else if (native_type == CREDIT_CARD_EXP_MONTH) |
387 SetExpirationMonthFromString(value, app_locale); | 388 SetExpirationMonthFromString(value, app_locale); |
388 else | 389 else |
389 SetRawInfo(native_type, value); | 390 SetRawInfo(native_type, value); |
390 | 391 |
391 return true; | 392 return true; |
392 } | 393 } |
393 | 394 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 const char* const kAmericanExpressCard = "americanExpressCC"; | 705 const char* const kAmericanExpressCard = "americanExpressCC"; |
705 const char* const kDinersCard = "dinersCC"; | 706 const char* const kDinersCard = "dinersCC"; |
706 const char* const kDiscoverCard = "discoverCC"; | 707 const char* const kDiscoverCard = "discoverCC"; |
707 const char* const kGenericCard = "genericCC"; | 708 const char* const kGenericCard = "genericCC"; |
708 const char* const kJCBCard = "jcbCC"; | 709 const char* const kJCBCard = "jcbCC"; |
709 const char* const kMasterCard = "masterCardCC"; | 710 const char* const kMasterCard = "masterCardCC"; |
710 const char* const kUnionPay = "unionPayCC"; | 711 const char* const kUnionPay = "unionPayCC"; |
711 const char* const kVisaCard = "visaCC"; | 712 const char* const kVisaCard = "visaCC"; |
712 | 713 |
713 } // namespace autofill | 714 } // namespace autofill |
OLD | NEW |