Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: components/autofill/browser/credit_card.cc

Issue 14096009: [Autofill] Split off AutofillDataModel as a subclass of FormData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android compile Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/form_group.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/credit_card.cc
diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc
index 78765d9d1223d663a72d5ff93e5d049f8df51e0b..21971ebbec7d5314efb0f3bf5f34b737cc89bbf8 100644
--- a/components/autofill/browser/credit_card.cc
+++ b/components/autofill/browser/credit_card.cc
@@ -194,20 +194,21 @@ bool ConvertMonth(const base::string16& month,
} // namespace
CreditCard::CreditCard(const std::string& guid)
- : type_(kGenericCard),
+ : AutofillDataModel(guid),
+ type_(kGenericCard),
expiration_month_(0),
- expiration_year_(0),
- guid_(guid) {
+ expiration_year_(0) {
}
CreditCard::CreditCard()
- : type_(kGenericCard),
+ : AutofillDataModel(base::GenerateGUID()),
+ type_(kGenericCard),
expiration_month_(0),
- expiration_year_(0),
- guid_(base::GenerateGUID()) {
+ expiration_year_(0) {
}
-CreditCard::CreditCard(const CreditCard& credit_card) : FormGroup() {
+CreditCard::CreditCard(const CreditCard& credit_card)
+ : AutofillDataModel(std::string()) {
operator=(credit_card);
}
@@ -244,10 +245,6 @@ base::string16 CreditCard::TypeForDisplay(const std::string& type) {
return base::string16();
}
-std::string CreditCard::GetGUID() const {
- return guid();
-}
-
base::string16 CreditCard::GetRawInfo(AutofillFieldType type) const {
switch (type) {
case CREDIT_CARD_NAME:
@@ -488,7 +485,8 @@ void CreditCard::operator=(const CreditCard& credit_card) {
type_ = credit_card.type_;
expiration_month_ = credit_card.expiration_month_;
expiration_year_ = credit_card.expiration_year_;
- guid_ = credit_card.guid_;
+
+ set_guid(credit_card.guid());
}
bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card,
@@ -554,10 +552,7 @@ int CreditCard::Compare(const CreditCard& credit_card) const {
}
bool CreditCard::operator==(const CreditCard& credit_card) const {
- if (guid_ != credit_card.guid_)
- return false;
-
- return Compare(credit_card) == 0;
+ return guid() == credit_card.guid() && Compare(credit_card) == 0;
}
bool CreditCard::operator!=(const CreditCard& credit_card) const {
« no previous file with comments | « components/autofill/browser/credit_card.h ('k') | components/autofill/browser/form_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698