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

Side by Side Diff: components/autofill/core/browser/credit_card.cc

Issue 1885773002: [Autofill] Don't fill expiration date of expired credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 8 months 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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 base::TrimString(icu_month, base::ASCIIToUTF16("."), &icu_month); 764 base::TrimString(icu_month, base::ASCIIToUTF16("."), &icu_month);
765 if (compare.StringsEqual(icu_month, trimmed_month)) { 765 if (compare.StringsEqual(icu_month, trimmed_month)) {
766 *num = i + 1; // Adjust from 0-indexed to 1-indexed. 766 *num = i + 1; // Adjust from 0-indexed to 1-indexed.
767 return true; 767 return true;
768 } 768 }
769 } 769 }
770 770
771 return false; 771 return false;
772 } 772 }
773 773
774 bool CreditCard::IsExpired(const base::Time& current_time) const {
775 return !IsValidCreditCardExpirationDate(expiration_year_, expiration_month_,
776 current_time);
777 }
778
774 // So we can compare CreditCards with EXPECT_EQ(). 779 // So we can compare CreditCards with EXPECT_EQ().
775 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { 780 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) {
776 return os << base::UTF16ToUTF8(credit_card.Label()) << " " 781 return os << base::UTF16ToUTF8(credit_card.Label()) << " "
777 << credit_card.guid() << " " << credit_card.origin() << " " 782 << credit_card.guid() << " " << credit_card.origin() << " "
778 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NAME_FULL)) 783 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NAME_FULL))
779 << " " 784 << " "
780 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_TYPE)) 785 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_TYPE))
781 << " " 786 << " "
782 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NUMBER)) 787 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NUMBER))
783 << " " 788 << " "
784 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_EXP_MONTH)) 789 << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_EXP_MONTH))
785 << " " << base::UTF16ToUTF8( 790 << " " << base::UTF16ToUTF8(
786 credit_card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); 791 credit_card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR));
787 } 792 }
788 793
789 // These values must match the values in WebKitPlatformSupportImpl in 794 // These values must match the values in WebKitPlatformSupportImpl in
790 // webkit/glue. We send these strings to WebKit, which then asks 795 // webkit/glue. We send these strings to WebKit, which then asks
791 // WebKitPlatformSupportImpl to load the image data. 796 // WebKitPlatformSupportImpl to load the image data.
792 const char kAmericanExpressCard[] = "americanExpressCC"; 797 const char kAmericanExpressCard[] = "americanExpressCC";
793 const char kDinersCard[] = "dinersCC"; 798 const char kDinersCard[] = "dinersCC";
794 const char kDiscoverCard[] = "discoverCC"; 799 const char kDiscoverCard[] = "discoverCC";
795 const char kGenericCard[] = "genericCC"; 800 const char kGenericCard[] = "genericCC";
796 const char kJCBCard[] = "jcbCC"; 801 const char kJCBCard[] = "jcbCC";
797 const char kMasterCard[] = "masterCardCC"; 802 const char kMasterCard[] = "masterCardCC";
798 const char kUnionPay[] = "unionPayCC"; 803 const char kUnionPay[] = "unionPayCC";
799 const char kVisaCard[] = "visaCC"; 804 const char kVisaCard[] = "visaCC";
800 805
801 } // namespace autofill 806 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.h ('k') | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698