OLD | NEW |
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 | 8 |
9 #include <ostream> | 9 #include <ostream> |
10 #include <string> | 10 #include <string> |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 break; | 364 break; |
365 | 365 |
366 default: | 366 default: |
367 NOTREACHED() << "Attempting to set unknown info-type " << type; | 367 NOTREACHED() << "Attempting to set unknown info-type " << type; |
368 break; | 368 break; |
369 } | 369 } |
370 } | 370 } |
371 | 371 |
372 base::string16 CreditCard::GetInfo(const AutofillType& type, | 372 base::string16 CreditCard::GetInfo(const AutofillType& type, |
373 const std::string& app_locale) const { | 373 const std::string& app_locale) const { |
374 if (type.server_type() == CREDIT_CARD_NUMBER) | 374 ServerFieldType storable_type = type.GetStorableType(); |
| 375 if (storable_type == CREDIT_CARD_NUMBER) |
375 return StripSeparators(number_); | 376 return StripSeparators(number_); |
376 | 377 |
377 return GetRawInfo(type.server_type()); | 378 return GetRawInfo(storable_type); |
378 } | 379 } |
379 | 380 |
380 bool CreditCard::SetInfo(const AutofillType& type, | 381 bool CreditCard::SetInfo(const AutofillType& type, |
381 const base::string16& value, | 382 const base::string16& value, |
382 const std::string& app_locale) { | 383 const std::string& app_locale) { |
383 ServerFieldType server_type = type.server_type(); | 384 ServerFieldType storable_type = type.GetStorableType(); |
384 if (server_type == CREDIT_CARD_NUMBER) | 385 if (storable_type == CREDIT_CARD_NUMBER) |
385 SetRawInfo(server_type, StripSeparators(value)); | 386 SetRawInfo(storable_type, StripSeparators(value)); |
386 else if (server_type == CREDIT_CARD_EXP_MONTH) | 387 else if (storable_type == CREDIT_CARD_EXP_MONTH) |
387 SetExpirationMonthFromString(value, app_locale); | 388 SetExpirationMonthFromString(value, app_locale); |
388 else | 389 else |
389 SetRawInfo(server_type, value); | 390 SetRawInfo(storable_type, value); |
390 | 391 |
391 return true; | 392 return true; |
392 } | 393 } |
393 | 394 |
394 void CreditCard::GetMatchingTypes(const base::string16& text, | 395 void CreditCard::GetMatchingTypes(const base::string16& text, |
395 const std::string& app_locale, | 396 const std::string& app_locale, |
396 ServerFieldTypeSet* matching_types) const { | 397 ServerFieldTypeSet* matching_types) const { |
397 FormGroup::GetMatchingTypes(text, app_locale, matching_types); | 398 FormGroup::GetMatchingTypes(text, app_locale, matching_types); |
398 | 399 |
399 base::string16 card_number = | 400 base::string16 card_number = |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 const char* const kAmericanExpressCard = "americanExpressCC"; | 705 const char* const kAmericanExpressCard = "americanExpressCC"; |
705 const char* const kDinersCard = "dinersCC"; | 706 const char* const kDinersCard = "dinersCC"; |
706 const char* const kDiscoverCard = "discoverCC"; | 707 const char* const kDiscoverCard = "discoverCC"; |
707 const char* const kGenericCard = "genericCC"; | 708 const char* const kGenericCard = "genericCC"; |
708 const char* const kJCBCard = "jcbCC"; | 709 const char* const kJCBCard = "jcbCC"; |
709 const char* const kMasterCard = "masterCardCC"; | 710 const char* const kMasterCard = "masterCardCC"; |
710 const char* const kUnionPay = "unionPayCC"; | 711 const char* const kUnionPay = "unionPayCC"; |
711 const char* const kVisaCard = "visaCC"; | 712 const char* const kVisaCard = "visaCC"; |
712 | 713 |
713 } // namespace autofill | 714 } // namespace autofill |
OLD | NEW |