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

Unified Diff: components/autofill/core/browser/webdata/autofill_change.cc

Issue 1110833002: [autofill] Sync server card and address metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rewrite CreditCardChange::operator==() more clearly Created 5 years, 7 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/webdata/autofill_change.cc
diff --git a/components/autofill/core/browser/webdata/autofill_change.cc b/components/autofill/core/browser/webdata/autofill_change.cc
index c02bdd8464d8476d974f1cfd0a04e2c60f55af10..ed2a6be114e25aa8c3325977afb91289e9a8f8ad 100644
--- a/components/autofill/core/browser/webdata/autofill_change.cc
+++ b/components/autofill/core/browser/webdata/autofill_change.cc
@@ -36,4 +36,22 @@ bool AutofillProfileChange::operator==(
(type() != REMOVE) ? *profile() == *change.profile() : true;
}
+CreditCardChange::CreditCardChange(Type type,
+ const std::string& key,
+ const CreditCard* card)
+ : GenericAutofillChange<std::string>(type, key), card_(card) {
+ DCHECK(type == ADD ? (card && card->guid() == key) : true);
+ DCHECK(type == UPDATE ? (card && card->guid() == key) : true);
+ DCHECK(type == REMOVE ? !card : true);
Evan Stade 2015/05/20 21:35:37 change to boolean logic, ditch ternary operator
please use gerrit instead 2015/05/20 22:52:36 Ditched ternary operator in Patch Set 4.
+}
+
+CreditCardChange::~CreditCardChange() {
+}
+
+bool CreditCardChange::operator==(const CreditCardChange& change) const {
+ return type() == change.type() &&
+ key() == change.key() &&
+ (type() != REMOVE) ? *card() == *change.card() : true;
Evan Stade 2015/05/20 21:35:36 whitespace update didn't help me understand
please use gerrit instead 2015/05/20 22:52:36 Ditched ternary operator in Patch Set 4.
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698