summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/autofill_change.cc
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-18 18:32:45 +0000
committerBen Murdoch <benm@google.com>2010-11-18 18:38:07 +0000
commit513209b27ff55e2841eac0e4120199c23acce758 (patch)
treeaeba30bb08c5f47c57003544e378a377c297eee6 /chrome/browser/webdata/autofill_change.cc
parent164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff)
downloadexternal_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'chrome/browser/webdata/autofill_change.cc')
-rw-r--r--chrome/browser/webdata/autofill_change.cc90
1 files changed, 90 insertions, 0 deletions
diff --git a/chrome/browser/webdata/autofill_change.cc b/chrome/browser/webdata/autofill_change.cc
new file mode 100644
index 0000000..fd0cfbf
--- /dev/null
+++ b/chrome/browser/webdata/autofill_change.cc
@@ -0,0 +1,90 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/webdata/autofill_change.h"
+
+#include "chrome/browser/autofill/autofill_profile.h"
+#include "chrome/browser/autofill/credit_card.h"
+
+AutofillChange::AutofillChange(Type type, const AutofillKey& key)
+ : GenericAutofillChange<AutofillKey>(type, key) {
+}
+
+AutofillChange::~AutofillChange() {
+}
+
+AutofillProfileChange::AutofillProfileChange(Type type,
+ string16 key,
+ const AutoFillProfile* profile,
+ const string16& pre_update_label)
+ : GenericAutofillChange<string16>(type, key),
+ profile_(profile),
+ pre_update_label_(pre_update_label) {
+}
+
+AutofillProfileChange::~AutofillProfileChange() {
+}
+
+bool AutofillProfileChange::operator==(
+ const AutofillProfileChange& change) const {
+ if (type() != change.type() || key() != change.key())
+ return false;
+ if (type() == REMOVE)
+ return true;
+ if (*profile() != *change.profile())
+ return false;
+ return type() == ADD || pre_update_label_ == change.pre_update_label();
+}
+
+AutofillCreditCardChange::AutofillCreditCardChange(
+ Type type, string16 key, const CreditCard* credit_card)
+ : GenericAutofillChange<string16>(type, key), credit_card_(credit_card) {
+}
+
+AutofillCreditCardChange::~AutofillCreditCardChange() {
+}
+
+bool AutofillCreditCardChange::operator==(
+ const AutofillCreditCardChange& change) const {
+ return type() == change.type() &&
+ key() == change.key() &&
+ (type() != REMOVE) ? *credit_card() == *change.credit_card() : true;
+}
+
+AutofillProfileChangeGUID::AutofillProfileChangeGUID(
+ Type type, 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);
+}
+
+AutofillProfileChangeGUID::~AutofillProfileChangeGUID() {
+}
+
+bool AutofillProfileChangeGUID::operator==(
+ const AutofillProfileChangeGUID& change) const {
+ return type() == change.type() &&
+ key() == change.key() &&
+ (type() != REMOVE) ? *profile() == *change.profile() : true;
+}
+
+AutofillCreditCardChangeGUID::AutofillCreditCardChangeGUID(
+ Type type, std::string key, const CreditCard* credit_card)
+ : GenericAutofillChange<std::string>(type, key), credit_card_(credit_card) {
+ DCHECK(type == ADD ? (credit_card && credit_card->guid() == key) : true);
+ DCHECK(type == UPDATE ? (credit_card && credit_card->guid() == key) : true);
+ DCHECK(type == REMOVE ? !credit_card : true);
+}
+
+AutofillCreditCardChangeGUID::~AutofillCreditCardChangeGUID() {
+}
+
+bool AutofillCreditCardChangeGUID::operator==(
+ const AutofillCreditCardChangeGUID& change) const {
+ return type() == change.type() &&
+ key() == change.key() &&
+ (type() != REMOVE) ? *credit_card() == *change.credit_card() : true;
+}