Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1363)

Side by Side Diff: components/autofill/core/browser/autofill_data_util.cc

Issue 2827243004: [Payment Request] Adds a11y label resource IDs to the basic card data (Closed)
Patch Set: Fixed compile error Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_data_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/grit/components_scaled_resources.h" 15 #include "components/grit/components_scaled_resources.h"
16 #include "components/strings/grit/components_strings.h"
16 #include "third_party/icu/source/common/unicode/uscript.h" 17 #include "third_party/icu/source/common/unicode/uscript.h"
17 18
18 namespace autofill { 19 namespace autofill {
19 namespace data_util { 20 namespace data_util {
20 21
21 namespace { 22 namespace {
22 // Mappings from Chrome card types to Payment Request API basic card payment 23 // Mappings from Chrome card types to Payment Request API basic card payment
23 // spec types and icons. Note that "generic" is not in the spec. 24 // spec types and icons. Note that "generic" is not in the spec.
24 // https://w3c.github.io/webpayments-methods-card/#method-id 25 // https://w3c.github.io/webpayments-methods-card/#method-id
25 const PaymentRequestData kPaymentRequestData[]{ 26 const PaymentRequestData kPaymentRequestData[]{
26 {"americanExpressCC", "amex", IDR_AUTOFILL_PR_AMEX}, 27 {"americanExpressCC", "amex", IDR_AUTOFILL_PR_AMEX, IDS_AUTOFILL_CC_AMEX},
27 {"dinersCC", "diners", IDR_AUTOFILL_PR_DINERS}, 28 {"dinersCC", "diners", IDR_AUTOFILL_PR_DINERS, IDS_AUTOFILL_CC_DINERS},
28 {"discoverCC", "discover", IDR_AUTOFILL_PR_DISCOVER}, 29 {"discoverCC", "discover", IDR_AUTOFILL_PR_DISCOVER,
29 {"jcbCC", "jcb", IDR_AUTOFILL_PR_JCB}, 30 IDS_AUTOFILL_CC_DISCOVER},
30 {"masterCardCC", "mastercard", IDR_AUTOFILL_PR_MASTERCARD}, 31 {"jcbCC", "jcb", IDR_AUTOFILL_PR_JCB, IDS_AUTOFILL_CC_JCB},
31 {"mirCC", "mir", IDR_AUTOFILL_PR_MIR}, 32 {"masterCardCC", "mastercard", IDR_AUTOFILL_PR_MASTERCARD,
32 {"unionPayCC", "unionpay", IDR_AUTOFILL_PR_UNIONPAY}, 33 IDS_AUTOFILL_CC_MASTERCARD},
33 {"visaCC", "visa", IDR_AUTOFILL_PR_VISA}, 34 {"mirCC", "mir", IDR_AUTOFILL_PR_MIR, IDS_AUTOFILL_CC_MIR},
35 {"unionPayCC", "unionpay", IDR_AUTOFILL_PR_UNIONPAY,
36 IDS_AUTOFILL_CC_UNION_PAY},
37 {"visaCC", "visa", IDR_AUTOFILL_PR_VISA, IDS_AUTOFILL_CC_VISA},
34 }; 38 };
35 const PaymentRequestData kGenericPaymentRequestData = {"genericCC", "generic", 39 const PaymentRequestData kGenericPaymentRequestData = {
36 IDR_AUTOFILL_PR_GENERIC}; 40 "genericCC", "generic", IDR_AUTOFILL_PR_GENERIC, IDS_AUTOFILL_CC_GENERIC};
37 41
38 const char* const name_prefixes[] = { 42 const char* const name_prefixes[] = {
39 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt", 43 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt",
40 "captain", "col", "cpt", "dr", "gen", "general", "lcdr", 44 "captain", "col", "cpt", "dr", "gen", "general", "lcdr",
41 "lt", "ltc", "ltg", "ltjg", "maj", "major", "mg", 45 "lt", "ltc", "ltg", "ltjg", "maj", "major", "mg",
42 "mr", "mrs", "ms", "pastor", "prof", "rep", "reverend", 46 "mr", "mrs", "ms", "pastor", "prof", "rep", "reverend",
43 "rev", "sen", "st"}; 47 "rev", "sen", "st"};
44 48
45 const char* const name_suffixes[] = {"b.a", "ba", "d.d.s", "dds", "i", "ii", 49 const char* const name_suffixes[] = {"b.a", "ba", "d.d.s", "dds", "i", "ii",
46 "iii", "iv", "ix", "jr", "m.a", "m.d", 50 "iii", "iv", "ix", "jr", "m.a", "m.d",
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 for (const PaymentRequestData& data : kPaymentRequestData) { 418 for (const PaymentRequestData& data : kPaymentRequestData) {
415 if (basic_card_payment_type == data.basic_card_payment_type) { 419 if (basic_card_payment_type == data.basic_card_payment_type) {
416 return data.card_type; 420 return data.card_type;
417 } 421 }
418 } 422 }
419 return kGenericPaymentRequestData.card_type; 423 return kGenericPaymentRequestData.card_type;
420 } 424 }
421 425
422 } // namespace data_util 426 } // namespace data_util
423 } // namespace autofill 427 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_data_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698