| 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/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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return WalletItems::MaskedInstrument::DISABLED_FOR_THIS_MERCHANT; | 73 return WalletItems::MaskedInstrument::DISABLED_FOR_THIS_MERCHANT; |
| 74 if (status_string == "UNSUPPORTED_COUNTRY") | 74 if (status_string == "UNSUPPORTED_COUNTRY") |
| 75 return WalletItems::MaskedInstrument::UNSUPPORTED_COUNTRY; | 75 return WalletItems::MaskedInstrument::UNSUPPORTED_COUNTRY; |
| 76 if (status_string == "EXPIRED") | 76 if (status_string == "EXPIRED") |
| 77 return WalletItems::MaskedInstrument::EXPIRED; | 77 return WalletItems::MaskedInstrument::EXPIRED; |
| 78 if (status_string == "BILLING_INCOMPLETE") | 78 if (status_string == "BILLING_INCOMPLETE") |
| 79 return WalletItems::MaskedInstrument::BILLING_INCOMPLETE; | 79 return WalletItems::MaskedInstrument::BILLING_INCOMPLETE; |
| 80 return WalletItems::MaskedInstrument::INAPPLICABLE; | 80 return WalletItems::MaskedInstrument::INAPPLICABLE; |
| 81 } | 81 } |
| 82 | 82 |
| 83 std::string StringIdentifierFromType(WalletItems::MaskedInstrument::Type type) { |
| 84 switch (type) { |
| 85 case WalletItems::MaskedInstrument::VISA: |
| 86 return kVisaCard; |
| 87 case WalletItems::MaskedInstrument::MASTER_CARD: |
| 88 return kMasterCard; |
| 89 case WalletItems::MaskedInstrument::AMEX: |
| 90 return kAmericanExpressCard; |
| 91 case WalletItems::MaskedInstrument::DISCOVER: |
| 92 return kDiscoverCard; |
| 93 default: |
| 94 return kGenericCard; |
| 95 } |
| 96 } |
| 97 |
| 83 } // anonymous namespace | 98 } // anonymous namespace |
| 84 | 99 |
| 85 WalletItems::MaskedInstrument::MaskedInstrument( | 100 WalletItems::MaskedInstrument::MaskedInstrument( |
| 86 const base::string16& descriptive_name, | 101 const base::string16& descriptive_name, |
| 87 const WalletItems::MaskedInstrument::Type& type, | 102 const WalletItems::MaskedInstrument::Type& type, |
| 88 const std::vector<base::string16>& supported_currencies, | 103 const std::vector<base::string16>& supported_currencies, |
| 89 const base::string16& last_four_digits, | 104 const base::string16& last_four_digits, |
| 90 int expiration_month, | 105 int expiration_month, |
| 91 int expiration_year, | 106 int expiration_year, |
| 92 scoped_ptr<Address> address, | 107 scoped_ptr<Address> address, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 335 |
| 321 case CREDIT_CARD_NUMBER: | 336 case CREDIT_CARD_NUMBER: |
| 322 return DisplayName(); | 337 return DisplayName(); |
| 323 | 338 |
| 324 case CREDIT_CARD_EXP_4_DIGIT_YEAR: | 339 case CREDIT_CARD_EXP_4_DIGIT_YEAR: |
| 325 return base::IntToString16(expiration_year()); | 340 return base::IntToString16(expiration_year()); |
| 326 | 341 |
| 327 case CREDIT_CARD_VERIFICATION_CODE: | 342 case CREDIT_CARD_VERIFICATION_CODE: |
| 328 break; | 343 break; |
| 329 | 344 |
| 345 case CREDIT_CARD_TYPE: |
| 346 return UTF8ToUTF16(StringIdentifierFromType(type_)); |
| 347 |
| 330 default: | 348 default: |
| 331 NOTREACHED(); | 349 NOTREACHED(); |
| 332 } | 350 } |
| 333 | 351 |
| 334 return base::string16(); | 352 return base::string16(); |
| 335 } | 353 } |
| 336 | 354 |
| 337 WalletItems::LegalDocument::~LegalDocument() {} | 355 WalletItems::LegalDocument::~LegalDocument() {} |
| 338 | 356 |
| 339 scoped_ptr<WalletItems::LegalDocument> | 357 scoped_ptr<WalletItems::LegalDocument> |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 VectorsAreEqual<LegalDocument>(legal_documents(), | 534 VectorsAreEqual<LegalDocument>(legal_documents(), |
| 517 other.legal_documents()); | 535 other.legal_documents()); |
| 518 } | 536 } |
| 519 | 537 |
| 520 bool WalletItems::operator!=(const WalletItems& other) const { | 538 bool WalletItems::operator!=(const WalletItems& other) const { |
| 521 return !(*this == other); | 539 return !(*this == other); |
| 522 } | 540 } |
| 523 | 541 |
| 524 } // namespace wallet | 542 } // namespace wallet |
| 525 } // namespace autofill | 543 } // namespace autofill |
| OLD | NEW |