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 <algorithm> | 9 #include <algorithm> |
10 #include <ostream> | 10 #include <ostream> |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 default: | 400 default: |
401 NOTREACHED() << "Attempting to set unknown info-type " << type; | 401 NOTREACHED() << "Attempting to set unknown info-type " << type; |
402 break; | 402 break; |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 base::string16 CreditCard::GetInfo(const AutofillType& type, | 406 base::string16 CreditCard::GetInfo(const AutofillType& type, |
407 const std::string& app_locale) const { | 407 const std::string& app_locale) const { |
408 ServerFieldType storable_type = type.GetStorableType(); | 408 ServerFieldType storable_type = type.GetStorableType(); |
409 if (storable_type == CREDIT_CARD_NUMBER) | 409 if (storable_type == CREDIT_CARD_NUMBER) { |
| 410 // Web pages should never actually be filled by a masked server card, |
| 411 // but this function is used at the preview stage. |
| 412 if (record_type() == MASKED_SERVER_CARD) |
| 413 return TypeAndLastFourDigits(); |
| 414 |
410 return StripSeparators(number_); | 415 return StripSeparators(number_); |
| 416 } |
411 | 417 |
412 return GetRawInfo(storable_type); | 418 return GetRawInfo(storable_type); |
413 } | 419 } |
414 | 420 |
415 bool CreditCard::SetInfo(const AutofillType& type, | 421 bool CreditCard::SetInfo(const AutofillType& type, |
416 const base::string16& value, | 422 const base::string16& value, |
417 const std::string& app_locale) { | 423 const std::string& app_locale) { |
418 ServerFieldType storable_type = type.GetStorableType(); | 424 ServerFieldType storable_type = type.GetStorableType(); |
419 if (storable_type == CREDIT_CARD_NUMBER) | 425 if (storable_type == CREDIT_CARD_NUMBER) |
420 SetRawInfo(storable_type, StripSeparators(value)); | 426 SetRawInfo(storable_type, StripSeparators(value)); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 const char* const kAmericanExpressCard = "americanExpressCC"; | 751 const char* const kAmericanExpressCard = "americanExpressCC"; |
746 const char* const kDinersCard = "dinersCC"; | 752 const char* const kDinersCard = "dinersCC"; |
747 const char* const kDiscoverCard = "discoverCC"; | 753 const char* const kDiscoverCard = "discoverCC"; |
748 const char* const kGenericCard = "genericCC"; | 754 const char* const kGenericCard = "genericCC"; |
749 const char* const kJCBCard = "jcbCC"; | 755 const char* const kJCBCard = "jcbCC"; |
750 const char* const kMasterCard = "masterCardCC"; | 756 const char* const kMasterCard = "masterCardCC"; |
751 const char* const kUnionPay = "unionPayCC"; | 757 const char* const kUnionPay = "unionPayCC"; |
752 const char* const kVisaCard = "visaCC"; | 758 const char* const kVisaCard = "visaCC"; |
753 | 759 |
754 } // namespace autofill | 760 } // namespace autofill |
OLD | NEW |