diff options
Diffstat (limited to 'chrome/browser/autofill/credit_card.h')
| -rw-r--r-- | chrome/browser/autofill/credit_card.h | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/chrome/browser/autofill/credit_card.h b/chrome/browser/autofill/credit_card.h index f437a90..91fc6ce 100644 --- a/chrome/browser/autofill/credit_card.h +++ b/chrome/browser/autofill/credit_card.h @@ -14,14 +14,11 @@ // A form group that stores credit card information. class CreditCard : public FormGroup { public: - // DEPRECATED - // TODO(dhollowa): Remove unique ID and label. http://crbug.com/58813 - CreditCard(const string16& label, int unique_id); explicit CreditCard(const std::string& guid); // For use in STL containers. CreditCard(); - CreditCard(const CreditCard& card); + CreditCard(const CreditCard& credit_card); virtual ~CreditCard(); // FormGroup implementation: @@ -35,7 +32,7 @@ class CreditCard : public FormGroup { virtual string16 GetFieldText(const AutoFillType& type) const; virtual string16 GetPreviewText(const AutoFillType& type) const; virtual void SetInfo(const AutoFillType& type, const string16& value); - const string16& Label() const { return label_; } + virtual const string16 Label() const { return label_; } // The number altered for display, for example: ******1234 string16 ObfuscatedNumber() const; @@ -45,26 +42,25 @@ class CreditCard : public FormGroup { string16 LastFourDigits() const; const string16& type() const { return type_; } - int billing_address_id() const { return billing_address_id_; } - - int unique_id() const { return unique_id_; } - void set_unique_id(int id) { unique_id_ = id; } // The guid is the primary identifier for |CreditCard| objects. const std::string guid() const { return guid_; } void set_guid(const std::string& guid) { guid_ = guid; } - // The caller should verify that the corresponding AutoFillProfile exists. - void set_billing_address_id(int address_id) { - billing_address_id_ = address_id; - } - // For use in STL containers. - void operator=(const CreditCard&); + void operator=(const CreditCard& credit_card); + + // Comparison for Sync. Returns 0 if the credit card is the same as |this|, + // or < 0, or > 0 if it is different. The implied ordering can be used for + // culling duplicates. The ordering is based on collation order of the + // textual contents of the fields. + // GUIDs, labels, and unique IDs are not compared, only the values of the + // credit cards themselves. + int Compare(const CreditCard& credit_card) const; // Used by tests. - bool operator==(const CreditCard& creditcard) const; - bool operator!=(const CreditCard& creditcard) const; + bool operator==(const CreditCard& credit_card) const; + bool operator!=(const CreditCard& credit_card) const; void set_label(const string16& label) { label_ = label; } // Returns true if |value| is a credit card number. Uses the Luhn formula to @@ -147,18 +143,11 @@ class CreditCard : public FormGroup { // This is the display name of the card set by the user, e.g., Amazon Visa. string16 label_; - // The billing address. This is the unique ID of the AutoFillProfile that - // contains the corresponding billing address. - int billing_address_id_; - - // The unique ID of this credit card. - int unique_id_; - // The guid of this credit card. std::string guid_; }; // So we can compare CreditCards with EXPECT_EQ(). -std::ostream& operator<<(std::ostream& os, const CreditCard& creditcard); +std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); #endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_ |
