| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/autofill_data_util.h" | 5 #include "components/autofill/core/browser/autofill_data_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "components/autofill/core/browser/field_types.h" | 14 #include "components/autofill/core/browser/field_types.h" |
| 15 #include "third_party/icu/source/common/unicode/uscript.h" | 15 #include "third_party/icu/source/common/unicode/uscript.h" |
| 16 | 16 |
| 17 namespace autofill { | 17 namespace autofill { |
| 18 namespace data_util { | 18 namespace data_util { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 // Mappings from Chrome card types to Payment Request API basic card payment | 21 // Mappings from Chrome card types to Payment Request API basic card payment |
| 22 // spec types and icons. Note that "generic" is not in the spec. | 22 // spec types and icons. Note that "generic" is not in the spec. |
| 23 // https://w3c.github.io/webpayments-methods-card/#method-id | 23 // https://w3c.github.io/webpayments-methods-card/#method-id |
| 24 const PaymentRequestData kPaymentRequestData[]{ | 24 const PaymentRequestData kPaymentRequestData[]{ |
| 25 {"americanExpressCC", "amex", IDR_AUTOFILL_PR_AMEX}, | 25 {"americanExpressCC", "amex", IDR_AUTOFILL_PR_AMEX}, |
| 26 {"dinersCC", "diners", IDR_AUTOFILL_PR_DINERS}, | 26 {"dinersCC", "diners", IDR_AUTOFILL_PR_DINERS}, |
| 27 {"discoverCC", "discover", IDR_AUTOFILL_PR_DISCOVER}, | 27 {"discoverCC", "discover", IDR_AUTOFILL_PR_DISCOVER}, |
| 28 {"jcbCC", "jcb", IDR_AUTOFILL_PR_JCB}, | 28 {"jcbCC", "jcb", IDR_AUTOFILL_PR_JCB}, |
| 29 {"masterCardCC", "mastercard", IDR_AUTOFILL_PR_MASTERCARD}, | 29 {"masterCardCC", "mastercard", IDR_AUTOFILL_PR_MASTERCARD}, |
| 30 {"mirCC", "mir", IDR_AUTOFILL_PR_MIR}, |
| 30 {"unionPayCC", "unionpay", IDR_AUTOFILL_PR_UNIONPAY}, | 31 {"unionPayCC", "unionpay", IDR_AUTOFILL_PR_UNIONPAY}, |
| 31 {"visaCC", "visa", IDR_AUTOFILL_PR_VISA}, | 32 {"visaCC", "visa", IDR_AUTOFILL_PR_VISA}, |
| 32 }; | 33 }; |
| 33 const PaymentRequestData kGenericPaymentRequestData = {"genericCC", "generic", | 34 const PaymentRequestData kGenericPaymentRequestData = {"genericCC", "generic", |
| 34 IDR_AUTOFILL_PR_GENERIC}; | 35 IDR_AUTOFILL_PR_GENERIC}; |
| 35 | 36 |
| 36 const char* const name_prefixes[] = { | 37 const char* const name_prefixes[] = { |
| 37 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt", | 38 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt", |
| 38 "captain", "col", "cpt", "dr", "gen", "general", "lcdr", | 39 "captain", "col", "cpt", "dr", "gen", "general", "lcdr", |
| 39 "lt", "ltc", "ltg", "ltjg", "maj", "major", "mg", | 40 "lt", "ltc", "ltg", "ltjg", "maj", "major", "mg", |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 for (const PaymentRequestData& data : kPaymentRequestData) { | 413 for (const PaymentRequestData& data : kPaymentRequestData) { |
| 413 if (basic_card_payment_type == data.basic_card_payment_type) { | 414 if (basic_card_payment_type == data.basic_card_payment_type) { |
| 414 return data.card_type; | 415 return data.card_type; |
| 415 } | 416 } |
| 416 } | 417 } |
| 417 return kGenericPaymentRequestData.card_type; | 418 return kGenericPaymentRequestData.card_type; |
| 418 } | 419 } |
| 419 | 420 |
| 420 } // namespace data_util | 421 } // namespace data_util |
| 421 } // namespace autofill | 422 } // namespace autofill |
| OLD | NEW |