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

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

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 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 15 matching lines...) Expand all
26 // A card from Wallet with masked information. Such cards will only have 26 // A card from Wallet with masked information. Such cards will only have
27 // the last 4 digits of the card number, and require an extra download to 27 // the last 4 digits of the card number, and require an extra download to
28 // convert to a FULL_SERVER_CARD. 28 // convert to a FULL_SERVER_CARD.
29 MASKED_SERVER_CARD, 29 MASKED_SERVER_CARD,
30 30
31 // A card from the Wallet server with full information. This card is not 31 // A card from the Wallet server with full information. This card is not
32 // locally editable. 32 // locally editable.
33 FULL_SERVER_CARD, 33 FULL_SERVER_CARD,
34 }; 34 };
35 35
36 // The status of this credit card. Only used for server cards.
37 enum ServerStatus {
38 EXPIRED,
39 OK,
40 };
41
36 CreditCard(const std::string& guid, const std::string& origin); 42 CreditCard(const std::string& guid, const std::string& origin);
37 CreditCard(const base::string16& card_number, 43 CreditCard(const base::string16& card_number,
38 int expiration_month, 44 int expiration_month,
39 int expiration_year); 45 int expiration_year);
40 46
41 // Creates a server card. The type must be MASKED_SERVER_CARD or 47 // Creates a server card. The type must be MASKED_SERVER_CARD or
42 // FULL_SERVER_CARD. 48 // FULL_SERVER_CARD.
43 CreditCard(RecordType type, const std::string& server_id); 49 CreditCard(RecordType type, const std::string& server_id);
44 50
45 // For use in STL containers. 51 // For use in STL containers.
(...skipping 19 matching lines...) Expand all
65 // the Issuer Identification Number (IIN), a.k.a. the "Bank Identification 71 // the Issuer Identification Number (IIN), a.k.a. the "Bank Identification
66 // Number (BIN)", which is parsed from the relevant prefix of the |number|. 72 // Number (BIN)", which is parsed from the relevant prefix of the |number|.
67 // This function performs no additional validation checks on the |number|. 73 // This function performs no additional validation checks on the |number|.
68 // Hence, the returned type for both the valid card "4111-1111-1111-1111" and 74 // Hence, the returned type for both the valid card "4111-1111-1111-1111" and
69 // the invalid card "4garbage" will be Visa, which has an IIN of 4. 75 // the invalid card "4garbage" will be Visa, which has an IIN of 4.
70 static const char* GetCreditCardType(const base::string16& number); 76 static const char* GetCreditCardType(const base::string16& number);
71 77
72 // Type strings are defined at the bottom of this file, e.g. kVisaCard. 78 // Type strings are defined at the bottom of this file, e.g. kVisaCard.
73 void SetTypeForMaskedCard(const char* type); 79 void SetTypeForMaskedCard(const char* type);
74 80
81 // Sets/gets the status of a server card.
82 void SetServerStatus(ServerStatus status);
83 ServerStatus GetServerStatus() const;
84
75 // FormGroup: 85 // FormGroup:
76 void GetMatchingTypes(const base::string16& text, 86 void GetMatchingTypes(const base::string16& text,
77 const std::string& app_locale, 87 const std::string& app_locale,
78 ServerFieldTypeSet* matching_types) const override; 88 ServerFieldTypeSet* matching_types) const override;
79 base::string16 GetRawInfo(ServerFieldType type) const override; 89 base::string16 GetRawInfo(ServerFieldType type) const override;
80 void SetRawInfo(ServerFieldType type, const base::string16& value) override; 90 void SetRawInfo(ServerFieldType type, const base::string16& value) override;
81 base::string16 GetInfo(const AutofillType& type, 91 base::string16 GetInfo(const AutofillType& type,
82 const std::string& app_locale) const override; 92 const std::string& app_locale) const override;
83 bool SetInfo(const AutofillType& type, 93 bool SetInfo(const AutofillType& type,
84 const base::string16& value, 94 const base::string16& value,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // The type of the card. This is one of the k...Card constants below. 202 // The type of the card. This is one of the k...Card constants below.
193 std::string type_; 203 std::string type_;
194 204
195 // These members are zero if not present. 205 // These members are zero if not present.
196 int expiration_month_; 206 int expiration_month_;
197 int expiration_year_; 207 int expiration_year_;
198 208
199 // For server cards (both MASKED and UNMASKED) this is the ID assigned by the 209 // For server cards (both MASKED and UNMASKED) this is the ID assigned by the
200 // server to uniquely identify this card. 210 // server to uniquely identify this card.
201 std::string server_id_; 211 std::string server_id_;
212
213 // The status of the card, as reported by the server. Not valid for local
214 // cards.
215 ServerStatus server_status_;
202 }; 216 };
203 217
204 // So we can compare CreditCards with EXPECT_EQ(). 218 // So we can compare CreditCards with EXPECT_EQ().
205 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card); 219 std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card);
206 220
207 // The string identifiers for credit card icon resources. 221 // The string identifiers for credit card icon resources.
208 extern const char* const kAmericanExpressCard; 222 extern const char* const kAmericanExpressCard;
209 extern const char* const kDinersCard; 223 extern const char* const kDinersCard;
210 extern const char* const kDiscoverCard; 224 extern const char* const kDiscoverCard;
211 extern const char* const kGenericCard; 225 extern const char* const kGenericCard;
212 extern const char* const kJCBCard; 226 extern const char* const kJCBCard;
213 extern const char* const kMasterCard; 227 extern const char* const kMasterCard;
214 extern const char* const kUnionPay; 228 extern const char* const kUnionPay;
215 extern const char* const kVisaCard; 229 extern const char* const kVisaCard;
216 230
217 } // namespace autofill 231 } // namespace autofill
218 232
219 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 233 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698