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

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

Issue 16034018: [Autofill] Support "importing" verified profiles and credit cards. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up comments Created 7 years, 6 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/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.

Powered by Google App Engine
This is Rietveld 408576698