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

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

Issue 870203002: Add status to server credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO Created 5 years, 11 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
Index: components/autofill/core/browser/credit_card.cc
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc
index 448feb91dc659afbe8d0d18c37c99941596c1675..cfae31bbba19da19779ab61966b465f2acbbc126 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -132,14 +132,16 @@ CreditCard::CreditCard(const std::string& guid, const std::string& origin)
record_type_(LOCAL_CARD),
type_(kGenericCard),
expiration_month_(0),
- expiration_year_(0) {
+ expiration_year_(0),
+ server_status_(OK) {
}
CreditCard::CreditCard(const base::string16& card_number,
int expiration_month,
int expiration_year)
: AutofillDataModel(std::string(), std::string()),
- record_type_(LOCAL_CARD) {
+ record_type_(LOCAL_CARD),
+ server_status_(OK) {
SetNumber(card_number);
SetExpirationMonth(expiration_month);
SetExpirationYear(expiration_year);
@@ -151,7 +153,8 @@ CreditCard::CreditCard(RecordType type, const std::string& server_id)
type_(kGenericCard),
expiration_month_(0),
expiration_year_(0),
- server_id_(server_id) {
+ server_id_(server_id),
+ server_status_(OK) {
DCHECK(type == MASKED_SERVER_CARD || type == FULL_SERVER_CARD);
}
@@ -160,7 +163,8 @@ CreditCard::CreditCard()
record_type_(LOCAL_CARD),
type_(kGenericCard),
expiration_month_(0),
- expiration_year_(0) {
+ expiration_year_(0),
+ server_status_(OK) {
}
CreditCard::CreditCard(const CreditCard& credit_card)
@@ -307,6 +311,16 @@ void CreditCard::SetTypeForMaskedCard(const char* type) {
type_ = type;
}
+void CreditCard::SetServerStatus(ServerStatus status) {
+ DCHECK_NE(LOCAL_CARD, record_type());
+ server_status_ = status;
+}
+
+CreditCard::ServerStatus CreditCard::GetServerStatus() const {
+ DCHECK_NE(LOCAL_CARD, record_type());
+ return server_status_;
+}
+
base::string16 CreditCard::GetRawInfo(ServerFieldType type) const {
DCHECK_EQ(CREDIT_CARD, AutofillType(type).group());
switch (type) {
@@ -525,6 +539,7 @@ void CreditCard::operator=(const CreditCard& credit_card) {
expiration_month_ = credit_card.expiration_month_;
expiration_year_ = credit_card.expiration_year_;
server_id_ = credit_card.server_id_;
+ server_status_ = credit_card.server_status_;
set_guid(credit_card.guid());
set_origin(credit_card.origin());
@@ -579,6 +594,12 @@ int CreditCard::Compare(const CreditCard& credit_card) const {
if (comparison != 0)
return comparison;
+ if (static_cast<int>(server_status_) <
+ static_cast<int>(credit_card.server_status_))
+ return -1;
+ if (static_cast<int>(server_status_) >
+ static_cast<int>(credit_card.server_status_))
+ return 1;
if (static_cast<int>(record_type_) <
static_cast<int>(credit_card.record_type_))
return -1;
« no previous file with comments | « components/autofill/core/browser/credit_card.h ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698