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

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

Issue 2621153002: [WebPayments] Add the Payment Method section in the Payment Sheet (Closed)
Patch Set: Initial patch Created 3 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 #include "components/autofill/core/browser/credit_card.h" 5 #include "components/autofill/core/browser/credit_card.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return IDR_AUTOFILL_CC_GENERIC; 148 return IDR_AUTOFILL_CC_GENERIC;
149 if (type == kVisaCard) 149 if (type == kVisaCard)
150 return IDR_AUTOFILL_CC_VISA; 150 return IDR_AUTOFILL_CC_VISA;
151 151
152 // If you hit this DCHECK, the above list of cases needs to be updated to 152 // If you hit this DCHECK, the above list of cases needs to be updated to
153 // include a new card. 153 // include a new card.
154 DCHECK_EQ(kGenericCard, type); 154 DCHECK_EQ(kGenericCard, type);
155 return IDR_AUTOFILL_CC_GENERIC; 155 return IDR_AUTOFILL_CC_GENERIC;
156 } 156 }
157 157
158 //static
159 int CreditCard::PaymentRequestIconResourceId(const std::string& type) {
Mathieu 2017/01/12 21:27:11 Would this fit alongside these: https://cs.chromiu
anthonyvd 2017/01/13 16:09:19 See Rouslan's comment below and my reply :)
160 if (type == kAmericanExpressCard)
please use gerrit instead 2017/01/12 19:34:02 return GetPaymentRequestData(type).icon_resource_i
anthonyvd 2017/01/13 16:09:19 Ahh, just what I needed! Removed this new function
161 return IDR_AUTOFILL_PR_AMEX;
162 if (type == kDinersCard)
163 return IDR_AUTOFILL_PR_DINERS;
164 if (type == kDiscoverCard)
165 return IDR_AUTOFILL_PR_DISCOVER;
166 if (type == kJCBCard)
167 return IDR_AUTOFILL_PR_JCB;
168 if (type == kMasterCard)
169 return IDR_AUTOFILL_PR_MASTERCARD;
170 if (type == kMirCard)
171 return IDR_AUTOFILL_PR_MIR;
172 if (type == kUnionPay)
173 return IDR_AUTOFILL_PR_GENERIC;
174 if (type == kVisaCard)
175 return IDR_AUTOFILL_PR_VISA;
176
177 // If you hit this DCHECK, the above list of cases needs to be updated to
178 // include a new card.
179 DCHECK_EQ(kGenericCard, type);
180 return IDR_AUTOFILL_PR_GENERIC;
181 }
182
158 // static 183 // static
159 const char* CreditCard::GetCreditCardType(const base::string16& number) { 184 const char* CreditCard::GetCreditCardType(const base::string16& number) {
160 // Credit card number specifications taken from: 185 // Credit card number specifications taken from:
161 // http://en.wikipedia.org/wiki/Credit_card_numbers, 186 // http://en.wikipedia.org/wiki/Credit_card_numbers,
162 // http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers, 187 // http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers,
163 // http://www.discovernetwork.com/merchants/images/Merchant_Marketing_PDF.pdf, 188 // http://www.discovernetwork.com/merchants/images/Merchant_Marketing_PDF.pdf,
164 // http://www.regular-expressions.info/creditcard.html, 189 // http://www.regular-expressions.info/creditcard.html,
165 // http://developer.ean.com/general_info/Valid_Credit_Card_Types, 190 // http://developer.ean.com/general_info/Valid_Credit_Card_Types,
166 // http://www.bincodes.com/, 191 // http://www.bincodes.com/,
167 // http://www.fraudpractice.com/FL-binCC.html, and 192 // http://www.fraudpractice.com/FL-binCC.html, and
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 const char kDinersCard[] = "dinersCC"; 897 const char kDinersCard[] = "dinersCC";
873 const char kDiscoverCard[] = "discoverCC"; 898 const char kDiscoverCard[] = "discoverCC";
874 const char kGenericCard[] = "genericCC"; 899 const char kGenericCard[] = "genericCC";
875 const char kJCBCard[] = "jcbCC"; 900 const char kJCBCard[] = "jcbCC";
876 const char kMasterCard[] = "masterCardCC"; 901 const char kMasterCard[] = "masterCardCC";
877 const char kMirCard[] = "mirCC"; 902 const char kMirCard[] = "mirCC";
878 const char kUnionPay[] = "unionPayCC"; 903 const char kUnionPay[] = "unionPayCC";
879 const char kVisaCard[] = "visaCC"; 904 const char kVisaCard[] = "visaCC";
880 905
881 } // namespace autofill 906 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698