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

Unified Diff: components/autofill/core/browser/credit_card.cc

Issue 1921003003: [Autofill] Update expired verified credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698