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

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

Issue 2514753002: Add Mir credit card support to autofill. (Closed)
Patch Set: Remove autofill sync modifications, optimize png files. Created 4 years, 1 month 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
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 "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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_popup_layout_model.cc ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698