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

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: Nits 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
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f9e44afb86d3849c5ebab32c67a329270b5f9d62 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -534,12 +534,22 @@ bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card,
return false;
}
- // Heuristically aggregated data should never overwrite verified data.
- // 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())
+ // Heuristically aggregated data should never overwrite verified data, with
+ // the exception of expired verified cards. 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 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());
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698