summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/autofill_change.h
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.h
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.h')
-rw-r--r--chrome/browser/webdata/autofill_change.h107
1 files changed, 77 insertions, 30 deletions
diff --git a/chrome/browser/webdata/autofill_change.h b/chrome/browser/webdata/autofill_change.h
index 11723d3..2a46399 100644
--- a/chrome/browser/webdata/autofill_change.h
+++ b/chrome/browser/webdata/autofill_change.h
@@ -6,8 +6,6 @@
#define CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__
#pragma once
-#include "chrome/browser/autofill/autofill_profile.h"
-#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/webdata/autofill_entry.h"
class AutoFillProfile;
@@ -40,53 +38,102 @@ class GenericAutofillChange {
class AutofillChange : public GenericAutofillChange<AutofillKey> {
public:
- AutofillChange(Type t, const AutofillKey& k)
- : GenericAutofillChange<AutofillKey>(t, k) {}
+ AutofillChange(Type type, const AutofillKey& key);
+ virtual ~AutofillChange();
bool operator==(const AutofillChange& change) const {
return type() == change.type() && key() == change.key();
}
};
+// DEPRECATED
+// TODO(dhollowa): Remove use of labels for sync. http://crbug.com/58813
class AutofillProfileChange : public GenericAutofillChange<string16> {
public:
- // If t == REMOVE, |p| should be NULL. |pre_update_label| only applies to
- // UPDATE changes.
- AutofillProfileChange(Type t, string16 k, const AutoFillProfile* p,
- const string16& pre_update_label)
- : GenericAutofillChange<string16>(t, k), profile_(p),
- pre_update_label_(pre_update_label) {}
+ // The |type| input specifies the change type. The |key| input is the key,
+ // which is expected to be the label identifying the |profile|.
+ // When |type| == ADD, |profile| should be non-NULL.
+ // When |type| == UPDATE, |profile| should be non-NULL.
+ // When |type| == REMOVE, |profile| should be NULL.
+ // The |pre_update_label| input specifies the label as it was prior to the
+ // change (applicable only for UPDATE).
+ AutofillProfileChange(Type type,
+ string16 key,
+ const AutoFillProfile* profile,
+ const string16& pre_update_label);
+ virtual ~AutofillProfileChange();
const AutoFillProfile* profile() const { return profile_; }
const string16& pre_update_label() const { return pre_update_label_; }
- bool operator==(const AutofillProfileChange& change) const {
- if (type() != change.type() || key() != change.key())
- return false;
- if (type() == REMOVE)
- return true;
- // TODO(dhollowa): Replace with |AutoFillProfile::Compare|.
- // http://crbug.com/58813
- if (*profile() != *change.profile())
- return false;
- return type() == ADD || pre_update_label_ == change.pre_update_label();
- }
+ bool operator==(const AutofillProfileChange& change) const;
+
private:
- const AutoFillProfile* profile_; // Unowned pointer, can be NULL.
+ // Weak reference, can be NULL.
+ const AutoFillProfile* profile_;
const string16 pre_update_label_;
};
+// DEPRECATED
+// TODO(dhollowa): Remove use of labels for sync. http://crbug.com/58813
class AutofillCreditCardChange : public GenericAutofillChange<string16> {
public:
- // If t == REMOVE, |card| should be NULL.
- AutofillCreditCardChange(Type t, string16 k, const CreditCard* card)
- : GenericAutofillChange<string16>(t, k), credit_card_(card) {}
+ // The |type| input specifies the change type. The |key| input is the key,
+ // which is expected to be the label identifying the |credit_card|.
+ // When |type| == ADD, |credit_card| should be non-NULL.
+ // When |type| == UPDATE, |credit_card| should be non-NULL.
+ // When |type| == REMOVE, |credit_card| should be NULL.
+ AutofillCreditCardChange(Type type,
+ string16 key,
+ const CreditCard* credit_card);
+ virtual ~AutofillCreditCardChange();
const CreditCard* credit_card() const { return credit_card_; }
- bool operator==(const AutofillCreditCardChange& change) const {
- return type() == change.type() && key() == change.key() &&
- (type() != REMOVE) ? *credit_card() == *change.credit_card() : true;
- }
+ bool operator==(const AutofillCreditCardChange& change) const;
+
+ private:
+ // Weak reference, can be NULL.
+ const CreditCard* credit_card_;
+};
+
+// Change notification details for AutoFill profile changes.
+class AutofillProfileChangeGUID : public GenericAutofillChange<std::string> {
+ public:
+ // The |type| input specifies the change type. The |key| input is the key,
+ // which is expected to be the GUID identifying the |profile|.
+ // When |type| == ADD, |profile| should be non-NULL.
+ // When |type| == UPDATE, |profile| should be non-NULL.
+ // When |type| == REMOVE, |profile| should be NULL.
+ AutofillProfileChangeGUID(Type type,
+ std::string key,
+ const AutoFillProfile* profile);
+ virtual ~AutofillProfileChangeGUID();
+
+ const AutoFillProfile* profile() const { return profile_; }
+ bool operator==(const AutofillProfileChangeGUID& change) const;
+
+ private:
+ // Weak reference, can be NULL.
+ const AutoFillProfile* profile_;
+};
+
+// Change notification details for AutoFill credit card changes.
+class AutofillCreditCardChangeGUID : public GenericAutofillChange<std::string> {
+ public:
+ // The |type| input specifies the change type. The |key| input is the key,
+ // which is expected to be the GUID identifying the |credit_card|.
+ // When |type| == ADD, |credit_card| should be non-NULL.
+ // When |type| == UPDATE, |credit_card| should be non-NULL.
+ // When |type| == REMOVE, |credit_card| should be NULL.
+ AutofillCreditCardChangeGUID(Type type,
+ std::string key,
+ const CreditCard* credit_card);
+ virtual ~AutofillCreditCardChangeGUID();
+
+ const CreditCard* credit_card() const { return credit_card_; }
+ bool operator==(const AutofillCreditCardChangeGUID& change) const;
+
private:
- const CreditCard* credit_card_; // Unowned pointer, can be NULL.
+ // Weak reference, can be NULL.
+ const CreditCard* credit_card_;
};
#endif // CHROME_BROWSER_WEBDATA_AUTOFILL_CHANGE_H__