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

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

Issue 1808613004: Don't ever attempt to upload credit cards whose numbers match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 9ea2ee76e9d734426fa39421f6d738f519dc163d..2d3129cdeaeb628f83a7336abd2b5168db37de04 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -606,11 +606,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