| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/wallet/instrument.h" | 5 #include "components/autofill/browser/wallet/instrument.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | |
| 9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "components/autofill/browser/autofill_country.h" | 12 #include "components/autofill/browser/autofill_country.h" |
| 13 #include "components/autofill/browser/autofill_profile.h" | 13 #include "components/autofill/browser/autofill_profile.h" |
| 14 #include "components/autofill/browser/credit_card.h" | 14 #include "components/autofill/browser/credit_card.h" |
| 15 #include "components/autofill/browser/validation.h" | 15 #include "components/autofill/browser/validation.h" |
| 16 #include "components/autofill/browser/wallet/wallet_address.h" | 16 #include "components/autofill/browser/wallet/wallet_address.h" |
| 17 | 17 |
| 18 namespace autofill { | 18 namespace autofill { |
| 19 namespace wallet { | 19 namespace wallet { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 case Instrument::JCB: | 50 case Instrument::JCB: |
| 51 return "JCB"; | 51 return "JCB"; |
| 52 } | 52 } |
| 53 NOTREACHED(); | 53 NOTREACHED(); |
| 54 return "NOT_POSSIBLE"; | 54 return "NOT_POSSIBLE"; |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 Instrument::Instrument(const CreditCard& card, | 59 Instrument::Instrument(const CreditCard& card, |
| 60 const string16& card_verification_number, | 60 const base::string16& card_verification_number, |
| 61 const AutofillProfile& profile) | 61 const AutofillProfile& profile) |
| 62 : primary_account_number_(card.GetRawInfo(CREDIT_CARD_NUMBER)), | 62 : primary_account_number_(card.GetRawInfo(CREDIT_CARD_NUMBER)), |
| 63 card_verification_number_(card_verification_number), | 63 card_verification_number_(card_verification_number), |
| 64 expiration_month_(card.expiration_month()), | 64 expiration_month_(card.expiration_month()), |
| 65 expiration_year_(card.expiration_year()), | 65 expiration_year_(card.expiration_year()), |
| 66 form_of_payment_(FormOfPaymentFromCardType(card.type())), | 66 form_of_payment_(FormOfPaymentFromCardType(card.type())), |
| 67 address_(new Address(profile)) { | 67 address_(new Address(profile)) { |
| 68 Init(); | 68 Init(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 Instrument::Instrument(const string16& primary_account_number, | 71 Instrument::Instrument(const base::string16& primary_account_number, |
| 72 const string16& card_verification_number, | 72 const base::string16& card_verification_number, |
| 73 int expiration_month, | 73 int expiration_month, |
| 74 int expiration_year, | 74 int expiration_year, |
| 75 FormOfPayment form_of_payment, | 75 FormOfPayment form_of_payment, |
| 76 scoped_ptr<Address> address) | 76 scoped_ptr<Address> address) |
| 77 : primary_account_number_(primary_account_number), | 77 : primary_account_number_(primary_account_number), |
| 78 card_verification_number_(card_verification_number), | 78 card_verification_number_(card_verification_number), |
| 79 expiration_month_(expiration_month), | 79 expiration_month_(expiration_month), |
| 80 expiration_year_(expiration_year), | 80 expiration_year_(expiration_year), |
| 81 form_of_payment_(form_of_payment), | 81 form_of_payment_(form_of_payment), |
| 82 address_(address.Pass()) { | 82 address_(address.Pass()) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 void Instrument::Init() { | 133 void Instrument::Init() { |
| 134 if (primary_account_number_.size() >= 4) { | 134 if (primary_account_number_.size() >= 4) { |
| 135 last_four_digits_ = | 135 last_four_digits_ = |
| 136 primary_account_number_.substr(primary_account_number_.size() - 4); | 136 primary_account_number_.substr(primary_account_number_.size() - 4); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace wallet | 140 } // namespace wallet |
| 141 } // namespace autofill | 141 } // namespace autofill |
| OLD | NEW |