Home | History | Annotate | Download | only in webdata
      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 
     13 AutofillChange::AutofillChange(Type type, const AutofillKey& key)
     14     : GenericAutofillChange<AutofillKey>(type, key) {
     15 }
     16 
     17 AutofillChange::~AutofillChange() {
     18 }
     19 
     20 AutofillProfileChange::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 
     29 AutofillProfileChange::~AutofillProfileChange() {
     30 }
     31 
     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;
     37 }
     38 
     39 }  // namespace autofill
     40