| 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 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 expiration_month_ != 0 && | 634 expiration_month_ != 0 && |
| 635 expiration_year_ != 0; | 635 expiration_year_ != 0; |
| 636 } | 636 } |
| 637 | 637 |
| 638 bool CreditCard::IsValid() const { | 638 bool CreditCard::IsValid() const { |
| 639 return IsValidCreditCardNumber(number_) && | 639 return IsValidCreditCardNumber(number_) && |
| 640 IsValidCreditCardExpirationDate( | 640 IsValidCreditCardExpirationDate( |
| 641 expiration_year_, expiration_month_, base::Time::Now()); | 641 expiration_year_, expiration_month_, base::Time::Now()); |
| 642 } | 642 } |
| 643 | 643 |
| 644 // TODO(crbug.com/589536): Upload new credit card types to the server. | |
| 645 void CreditCard::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { | 644 void CreditCard::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { |
| 646 supported_types->insert(CREDIT_CARD_NAME_FULL); | 645 supported_types->insert(CREDIT_CARD_NAME_FULL); |
| 646 supported_types->insert(CREDIT_CARD_NAME_FIRST); |
| 647 supported_types->insert(CREDIT_CARD_NAME_LAST); |
| 647 supported_types->insert(CREDIT_CARD_NUMBER); | 648 supported_types->insert(CREDIT_CARD_NUMBER); |
| 648 supported_types->insert(CREDIT_CARD_TYPE); | 649 supported_types->insert(CREDIT_CARD_TYPE); |
| 649 supported_types->insert(CREDIT_CARD_EXP_MONTH); | 650 supported_types->insert(CREDIT_CARD_EXP_MONTH); |
| 650 supported_types->insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); | 651 supported_types->insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); |
| 651 supported_types->insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); | 652 supported_types->insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
| 652 supported_types->insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); | 653 supported_types->insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); |
| 653 supported_types->insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); | 654 supported_types->insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); |
| 654 } | 655 } |
| 655 | 656 |
| 656 base::string16 CreditCard::ExpirationMonthAsString() const { | 657 base::string16 CreditCard::ExpirationMonthAsString() const { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 const char kAmericanExpressCard[] = "americanExpressCC"; | 792 const char kAmericanExpressCard[] = "americanExpressCC"; |
| 792 const char kDinersCard[] = "dinersCC"; | 793 const char kDinersCard[] = "dinersCC"; |
| 793 const char kDiscoverCard[] = "discoverCC"; | 794 const char kDiscoverCard[] = "discoverCC"; |
| 794 const char kGenericCard[] = "genericCC"; | 795 const char kGenericCard[] = "genericCC"; |
| 795 const char kJCBCard[] = "jcbCC"; | 796 const char kJCBCard[] = "jcbCC"; |
| 796 const char kMasterCard[] = "masterCardCC"; | 797 const char kMasterCard[] = "masterCardCC"; |
| 797 const char kUnionPay[] = "unionPayCC"; | 798 const char kUnionPay[] = "unionPayCC"; |
| 798 const char kVisaCard[] = "visaCC"; | 799 const char kVisaCard[] = "visaCC"; |
| 799 | 800 |
| 800 } // namespace autofill | 801 } // namespace autofill |
| OLD | NEW |