Index: components/autofill/core/browser/credit_card.cc |
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc |
index 4683c5e8d021c95fb281a161990ecdbd85d0842e..16fee3647b0f3966c22b2c4b1bfca6998fefd30f 100644 |
--- a/components/autofill/core/browser/credit_card.cc |
+++ b/components/autofill/core/browser/credit_card.cc |
@@ -538,8 +538,18 @@ bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card, |
// Instead, discard any heuristically aggregated credit cards that disagree |
// with explicitly entered data, so that the UI is not cluttered with |
// duplicate cards. |
- if (this->IsVerified() && !imported_card.IsVerified()) |
+ if (this->IsVerified() && !imported_card.IsVerified()) { |
+ // If the original card is expired and the imported card is not, and the |
+ // name on the cards are identical, update the expiration date. |
+ if (this->IsExpired(base::Time::Now()) && |
+ !imported_card.IsExpired(base::Time::Now()) && |
+ (name_on_card_ == imported_card.name_on_card_)) { |
+ DCHECK(imported_card.expiration_month_ && imported_card.expiration_year_); |
+ expiration_month_ = imported_card.expiration_month_; |
+ expiration_year_ = imported_card.expiration_year_; |
+ } |
return true; |
+ } |
set_origin(imported_card.origin()); |