1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/autofill/core/browser/webdata/autofill_change.h"
7 #include "base/logging.h"
8 #include "components/autofill/core/browser/autofill_profile.h"
9 #include "components/autofill/core/browser/credit_card.h"
13 AutofillChange::AutofillChange(Type type
, const AutofillKey
& key
)
14 : GenericAutofillChange
<AutofillKey
>(type
, key
) {
17 AutofillChange::~AutofillChange() {
20 AutofillProfileChange::AutofillProfileChange(
21 Type type
, const std::string
& key
, const AutofillProfile
* profile
)
22 : GenericAutofillChange
<std::string
>(type
, key
),
24 DCHECK(type
== ADD
? (profile
&& profile
->guid() == key
) : true);
25 DCHECK(type
== UPDATE
? (profile
&& profile
->guid() == key
) : true);
26 DCHECK(type
== REMOVE
? !profile
: true);
29 AutofillProfileChange::~AutofillProfileChange() {
32 bool AutofillProfileChange::operator==(
33 const AutofillProfileChange
& change
) const {
34 return type() == change
.type() &&
35 key() == change
.key() &&
36 (type() != REMOVE
) ? *profile() == *change
.profile() : true;
39 } // namespace autofill