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

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

Issue 1818403003: Don't ever attempt to upload credit cards whose numbers match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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 9083b4035b18829a2ae6e12c398c69b8ebce2c8b..6c92cccee5cad1b4a68a730d81beb0b0f20b833f 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -598,11 +598,17 @@ bool CreditCard::IsLocalDuplicateOfServerCard(const CreditCard& other) const {
if (number_.empty())
return true;
- if (other.record_type() == FULL_SERVER_CARD)
- return StripSeparators(number_) == StripSeparators(other.number_);
+ return HasSameNumberAs(other);
+}
+bool CreditCard::HasSameNumberAs(const CreditCard& other) const {
// For masked cards, this is the best we can do to compare card numbers.
- return TypeAndLastFourDigits() == other.TypeAndLastFourDigits();
+ if (record_type() == MASKED_SERVER_CARD ||
+ other.record_type() == MASKED_SERVER_CARD) {
+ return TypeAndLastFourDigits() == other.TypeAndLastFourDigits();
+ }
+
+ return StripSeparators(number_) == StripSeparators(other.number_);
}
bool CreditCard::operator==(const CreditCard& credit_card) const {
« no previous file with comments | « components/autofill/core/browser/credit_card.h ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698