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

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

Issue 2844463004: Rename card 'type' into 'issuer network.' (Closed)
Patch Set: read -> use Created 3 years, 7 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
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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_
7 7
8 #include <string>
9
8 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
9 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece_forward.h"
10 #include "components/autofill/core/browser/autofill_profile.h" 12 #include "components/autofill/core/browser/autofill_profile.h"
11 13
12 namespace autofill { 14 namespace autofill {
13 namespace data_util { 15 namespace data_util {
14 16
15 struct NameParts { 17 struct NameParts {
16 base::string16 given; 18 base::string16 given;
17 base::string16 middle; 19 base::string16 middle;
18 base::string16 family; 20 base::string16 family;
19 }; 21 };
20 22
21 // Used to map Chrome card types to Payment Request API basic card payment spec 23 // Used to map Chrome card issuer networks to Payment Request API basic card
22 // types and icons. https://w3c.github.io/webpayments-methods-card/#method-id 24 // payment spec issuer networks and icons.
25 // https://w3c.github.io/webpayments-methods-card/#method-id
23 struct PaymentRequestData { 26 struct PaymentRequestData {
24 const char* card_type; 27 const char* issuer_network;
25 const char* basic_card_payment_type; 28 const char* basic_card_issuer_network;
26 const int icon_resource_id; 29 const int icon_resource_id;
27 const int a11y_label_resource_id; 30 const int a11y_label_resource_id;
28 }; 31 };
29 32
30 // Returns true if |name| looks like a CJK name (or some kind of mish-mash of 33 // Returns true if |name| looks like a CJK name (or some kind of mish-mash of
31 // the three, at least). 34 // the three, at least).
32 bool IsCJKName(base::StringPiece16 name); 35 bool IsCJKName(base::StringPiece16 name);
33 36
34 // TODO(crbug.com/586510): Investigate the use of app_locale to do better name 37 // TODO(crbug.com/586510): Investigate the use of app_locale to do better name
35 // splitting. 38 // splitting.
(...skipping 10 matching lines...) Expand all
46 // Returns true iff |full_name| is a concatenation of some combination of the 49 // Returns true iff |full_name| is a concatenation of some combination of the
47 // first/middle/last (incl. middle initial) in |profile|. 50 // first/middle/last (incl. middle initial) in |profile|.
48 bool ProfileMatchesFullName(base::StringPiece16 full_name, 51 bool ProfileMatchesFullName(base::StringPiece16 full_name,
49 const autofill::AutofillProfile& profile); 52 const autofill::AutofillProfile& profile);
50 53
51 // Returns the Payment Request API basic card payment spec data for the provided 54 // Returns the Payment Request API basic card payment spec data for the provided
52 // autofill credit card |type|. Will set the type and the icon to "generic" for 55 // autofill credit card |type|. Will set the type and the icon to "generic" for
53 // any unrecognized type. 56 // any unrecognized type.
54 const PaymentRequestData& GetPaymentRequestData(const std::string& type); 57 const PaymentRequestData& GetPaymentRequestData(const std::string& type);
55 58
56 // Returns the autofill credit card type string for the provided Payment Request 59 // Returns the autofill credit card issuer network string for the provided
57 // API basic card payment spec |type|. 60 // Payment Request API basic card payment spec |basic_card_card_issuer_network|.
58 const char* GetCardTypeForBasicCardPaymentType(const std::string& type); 61 const char* GetIssuerNetworkForBasicCardIssuerNetwork(
62 const std::string& basic_card_issuer_network);
59 63
60 // Returns whether the specified |country_code| is a valid country code. 64 // Returns whether the specified |country_code| is a valid country code.
61 bool IsValidCountryCode(const std::string& country_code); 65 bool IsValidCountryCode(const std::string& country_code);
62 bool IsValidCountryCode(const base::string16& country_code); 66 bool IsValidCountryCode(const base::string16& country_code);
63 67
64 } // namespace data_util 68 } // namespace data_util
65 } // namespace autofill 69 } // namespace autofill
66 70
67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_ 71 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698