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

Side by Side Diff: components/autofill/content/browser/wallet/wallet_items.cc

Issue 16254010: [Autofill] Update credit card type detection logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 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 | Annotate | Revision Log
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/content/browser/wallet/wallet_items.h" 5 #include "components/autofill/content/browser/wallet/wallet_items.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 base::string16 WalletItems::MaskedInstrument::TypeAndLastFourDigits() const { 263 base::string16 WalletItems::MaskedInstrument::TypeAndLastFourDigits() const {
264 base::string16 display_type; 264 base::string16 display_type;
265 265
266 if (type_ == AMEX) 266 if (type_ == AMEX)
267 display_type = CreditCard::TypeForDisplay(kAmericanExpressCard); 267 display_type = CreditCard::TypeForDisplay(kAmericanExpressCard);
268 else if (type_ == DISCOVER) 268 else if (type_ == DISCOVER)
269 display_type = CreditCard::TypeForDisplay(kDiscoverCard); 269 display_type = CreditCard::TypeForDisplay(kDiscoverCard);
270 else if (type_ == MASTER_CARD) 270 else if (type_ == MASTER_CARD)
271 display_type = CreditCard::TypeForDisplay(kMasterCard); 271 display_type = CreditCard::TypeForDisplay(kMasterCard);
272 else if (type_ == SOLO)
273 display_type = CreditCard::TypeForDisplay(kSoloCard);
274 else if (type_ == VISA) 272 else if (type_ == VISA)
275 display_type = CreditCard::TypeForDisplay(kVisaCard); 273 display_type = CreditCard::TypeForDisplay(kVisaCard);
276 else 274 else
277 display_type = CreditCard::TypeForDisplay(kGenericCard); 275 display_type = CreditCard::TypeForDisplay(kGenericCard);
278 276
279 // TODO(dbeam): i18n. 277 // TODO(dbeam): i18n.
280 return display_type + ASCIIToUTF16(" - ") + last_four_digits(); 278 return display_type + ASCIIToUTF16(" - ") + last_four_digits();
281 } 279 }
282 280
283 const gfx::Image& WalletItems::MaskedInstrument::CardIcon() const { 281 const gfx::Image& WalletItems::MaskedInstrument::CardIcon() const {
284 int idr = 0; 282 int idr = 0;
285 switch (type_) { 283 switch (type_) {
286 case AMEX: 284 case AMEX:
287 idr = IDR_AUTOFILL_CC_AMEX; 285 idr = IDR_AUTOFILL_CC_AMEX;
288 break; 286 break;
289 287
290 case DISCOVER: 288 case DISCOVER:
291 idr = IDR_AUTOFILL_CC_DISCOVER; 289 idr = IDR_AUTOFILL_CC_DISCOVER;
292 break; 290 break;
293 291
294 case MASTER_CARD: 292 case MASTER_CARD:
295 idr = IDR_AUTOFILL_CC_MASTERCARD; 293 idr = IDR_AUTOFILL_CC_MASTERCARD;
296 break; 294 break;
297 295
298 case SOLO:
299 idr = IDR_AUTOFILL_CC_SOLO;
300 break;
301
302 case VISA: 296 case VISA:
303 idr = IDR_AUTOFILL_CC_VISA; 297 idr = IDR_AUTOFILL_CC_VISA;
304 break; 298 break;
305 299
300 case SOLO:
306 case MAESTRO: 301 case MAESTRO:
307 case SWITCH: 302 case SWITCH:
308 case UNKNOWN: 303 case UNKNOWN:
309 idr = IDR_AUTOFILL_CC_GENERIC; 304 idr = IDR_AUTOFILL_CC_GENERIC;
310 break; 305 break;
311 } 306 }
312 307
313 return ResourceBundle::GetSharedInstance().GetImageNamed(idr); 308 return ResourceBundle::GetSharedInstance().GetImageNamed(idr);
314 } 309 }
315 310
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 VectorsAreEqual<LegalDocument>(legal_documents(), 516 VectorsAreEqual<LegalDocument>(legal_documents(),
522 other.legal_documents()); 517 other.legal_documents());
523 } 518 }
524 519
525 bool WalletItems::operator!=(const WalletItems& other) const { 520 bool WalletItems::operator!=(const WalletItems& other) const {
526 return !(*this == other); 521 return !(*this == other);
527 } 522 }
528 523
529 } // namespace wallet 524 } // namespace wallet
530 } // namespace autofill 525 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698