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

Side by Side Diff: components/autofill/core/browser/credit_card.h

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 // A card from Wallet with full information. This card is not locally 30 // A card from Wallet with full information. This card is not locally
31 // editable. 31 // editable.
32 FULL_WALLET_CARD, 32 FULL_WALLET_CARD,
33 }; 33 };
34 34
35 CreditCard(const std::string& guid, const std::string& origin); 35 CreditCard(const std::string& guid, const std::string& origin);
36 CreditCard(const base::string16& card_number, 36 CreditCard(const base::string16& card_number,
37 int expiration_month, 37 int expiration_month,
38 int expiration_year); 38 int expiration_year);
39 39
40 // Creates a wallet card. This sets the wallet-specific records. To set the
41 // rest, use SetRawInfo like a normal card.
42 CreditCard(const std::string& wallet_id, RecordType type);
43
40 // For use in STL containers. 44 // For use in STL containers.
41 CreditCard(); 45 CreditCard();
42 CreditCard(const CreditCard& credit_card); 46 CreditCard(const CreditCard& credit_card);
43 ~CreditCard() override; 47 ~CreditCard() override;
44 48
45 // Returns a version of |number| that has any separator characters removed. 49 // Returns a version of |number| that has any separator characters removed.
46 static const base::string16 StripSeparators(const base::string16& number); 50 static const base::string16 StripSeparators(const base::string16& number);
47 51
48 // The user-visible type of the card, e.g. 'Mastercard'. 52 // The user-visible type of the card, e.g. 'Mastercard'.
49 static base::string16 TypeForDisplay(const std::string& type); 53 static base::string16 TypeForDisplay(const std::string& type);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // The user-visible type of the card, e.g. 'Mastercard'. 94 // The user-visible type of the card, e.g. 'Mastercard'.
91 base::string16 TypeForDisplay() const; 95 base::string16 TypeForDisplay() const;
92 // A label for this credit card formatted as 'Cardname - 2345'. 96 // A label for this credit card formatted as 'Cardname - 2345'.
93 base::string16 TypeAndLastFourDigits() const; 97 base::string16 TypeAndLastFourDigits() const;
94 98
95 const std::string& type() const { return type_; } 99 const std::string& type() const { return type_; }
96 100
97 int expiration_month() const { return expiration_month_; } 101 int expiration_month() const { return expiration_month_; }
98 int expiration_year() const { return expiration_year_; } 102 int expiration_year() const { return expiration_year_; }
99 103
104 const std::string& wallet_id() const { return wallet_id_; }
105
100 // For use in STL containers. 106 // For use in STL containers.
101 void operator=(const CreditCard& credit_card); 107 void operator=(const CreditCard& credit_card);
102 108
103 // If the card numbers for |this| and |imported_card| match, and merging the 109 // If the card numbers for |this| and |imported_card| match, and merging the
104 // two wouldn't result in unverified data overwriting verified data, 110 // two wouldn't result in unverified data overwriting verified data,
105 // overwrites |this| card's data with the data in |credit_card|. 111 // overwrites |this| card's data with the data in |credit_card|.
106 // Returns true if the card numbers match, false otherwise. 112 // Returns true if the card numbers match, false otherwise.
107 bool UpdateFromImportedCard(const CreditCard& imported_card, 113 bool UpdateFromImportedCard(const CreditCard& imported_card,
108 const std::string& app_locale) WARN_UNUSED_RESULT; 114 const std::string& app_locale) WARN_UNUSED_RESULT;
109 115
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 179
174 // The cardholder's name. May be empty. 180 // The cardholder's name. May be empty.
175 base::string16 name_on_card_; 181 base::string16 name_on_card_;
176 182
177 // The type of the card. This is one of the k...Card constants below. 183 // The type of the card. This is one of the k...Card constants below.
178 std::string type_; 184 std::string type_;
179 185
180 // These members are zero if not present. 186 // These members are zero if not present.
181 int expiration_month_; 187 int expiration_month_;
182 int expiration_year_; 188 int expiration_year_;
189
190 // For wallet cards (both MASKED and UNMASKED) this is the ID assigned by the
191 // server to uniquely identify this card.
192 std::string wallet_id_;
183 }; 193 };
184 194
185 // So we can compare CreditCards with EXPECT_EQ(). 195 // So we can compare CreditCards with EXPECT_EQ().
186 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); 196 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card);
187 197
188 // The string identifiers for credit card icon resources. 198 // The string identifiers for credit card icon resources.
189 extern const char* const kAmericanExpressCard; 199 extern const char* const kAmericanExpressCard;
190 extern const char* const kDinersCard; 200 extern const char* const kDinersCard;
191 extern const char* const kDiscoverCard; 201 extern const char* const kDiscoverCard;
192 extern const char* const kGenericCard; 202 extern const char* const kGenericCard;
193 extern const char* const kJCBCard; 203 extern const char* const kJCBCard;
194 extern const char* const kMasterCard; 204 extern const char* const kMasterCard;
195 extern const char* const kUnionPay; 205 extern const char* const kUnionPay;
196 extern const char* const kVisaCard; 206 extern const char* const kVisaCard;
197 207
198 } // namespace autofill 208 } // namespace autofill
199 209
200 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 210 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_sync_constants.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698