Chromium Code Reviews| 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..b6814a66329926063a4602dad8fdf37f35c8fea7 100644 |
| --- a/components/autofill/core/browser/webdata/autofill_change.cc |
| +++ b/components/autofill/core/browser/webdata/autofill_change.cc |
| @@ -17,13 +17,13 @@ AutofillChange::AutofillChange(Type type, const AutofillKey& key) |
| AutofillChange::~AutofillChange() { |
| } |
| -AutofillProfileChange::AutofillProfileChange( |
| - Type type, const std::string& key, const AutofillProfile* profile) |
| - : GenericAutofillChange<std::string>(type, key), |
| - profile_(profile) { |
| - DCHECK(type == ADD ? (profile && profile->guid() == key) : true); |
| - DCHECK(type == UPDATE ? (profile && profile->guid() == key) : true); |
| - DCHECK(type == REMOVE ? !profile : true); |
| +AutofillProfileChange::AutofillProfileChange(Type type, |
| + const std::string& key, |
| + const AutofillProfile* profile) |
| + : GenericAutofillChange<std::string>(type, key), profile_(profile) { |
| + DCHECK((type == ADD && profile && profile->guid() == key) || |
| + (type == UPDATE && profile && profile->guid() == key) || |
| + (type == REMOVE && !profile)); |
|
Peter Kasting
2015/05/20 23:11:21
Simpler:
DCHECK((type == REMOVE) ? !profile : (
please use gerrit instead
2015/05/21 00:13:48
That's a good one. I like that it's a one-liner.
|
| } |
| AutofillProfileChange::~AutofillProfileChange() { |
| @@ -31,9 +31,25 @@ AutofillProfileChange::~AutofillProfileChange() { |
| bool AutofillProfileChange::operator==( |
| const AutofillProfileChange& change) const { |
| - return type() == change.type() && |
| - key() == change.key() && |
| - (type() != REMOVE) ? *profile() == *change.profile() : true; |
| + return type() == change.type() && key() == change.key() && |
| + (type() == REMOVE || *profile() == *change.profile()); |
| +} |
| + |
| +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) || |
| + (type == UPDATE && card && card->guid() == key) || |
| + (type == REMOVE && !card)); |
|
Peter Kasting
2015/05/20 23:11:21
Simpler:
DCHECK((type == REMOVE) ? !card : (car
please use gerrit instead
2015/05/21 00:13:48
Ditto.
|
| +} |
| + |
| +CreditCardChange::~CreditCardChange() { |
| +} |
| + |
| +bool CreditCardChange::operator==(const CreditCardChange& change) const { |
| + return type() == change.type() && key() == change.key() && |
| + (type() == REMOVE || *card() == *change.card()); |
| } |
| } // namespace autofill |