Index: components/autofill/browser/credit_card.cc |
diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc |
index 0433231a332d4c046a9c9bed313b018328d6a0ea..c6a641b99b0b3258f0f10fa11dd8e6a7ff160b71 100644 |
--- a/components/autofill/browser/credit_card.cc |
+++ b/components/autofill/browser/credit_card.cc |
@@ -498,10 +498,15 @@ bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card, |
return false; |
} |
- DCHECK(!imported_card.IsVerified()); |
- if (this->IsVerified()) |
+ // 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()) |
return true; |
+ set_origin(imported_card.origin()); |
+ |
// Note that the card number is intentionally not updated, so as to preserve |
// any formatting (i.e. separator characters). Since the card number is not |
// updated, there is no reason to update the card type, either. |