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. 4 5 #include "components/autofill/core/browser/webdata/autofill_change.h" 6 7 #include "base/logging.h" 8 #include "components/autofill/core/browser/autofill_profile.h" 9 #include "components/autofill/core/browser/credit_card.h" 10 11 namespace autofill { 12 AutofillChange(Type type,const AutofillKey & key)13AutofillChange::AutofillChange(Type type, const AutofillKey& key) 14 : GenericAutofillChange<AutofillKey>(type, key) { 15 } 16 ~AutofillChange()17AutofillChange::~AutofillChange() { 18 } 19 AutofillProfileChange(Type type,const std::string & key,const AutofillProfile * profile)20AutofillProfileChange::AutofillProfileChange( 21 Type type, const std::string& key, const AutofillProfile* profile) 22 : GenericAutofillChange<std::string>(type, key), 23 profile_(profile) { 24 DCHECK(type == ADD ? (profile && profile->guid() == key) : true); 25 DCHECK(type == UPDATE ? (profile && profile->guid() == key) : true); 26 DCHECK(type == REMOVE ? !profile : true); 27 } 28 ~AutofillProfileChange()29AutofillProfileChange::~AutofillProfileChange() { 30 } 31 operator ==(const AutofillProfileChange & change) const32bool AutofillProfileChange::operator==( 33 const AutofillProfileChange& change) const { 34 return type() == change.type() && 35 key() == change.key() && 36 (type() != REMOVE) ? *profile() == *change.profile() : true; 37 } 38 39 } // namespace autofill 40