| 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 #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 "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| 11 | 11 |
| 12 namespace autofill { | 12 namespace autofill { |
| 13 namespace data_util { | 13 namespace data_util { |
| 14 | 14 |
| 15 struct NameParts { | 15 struct NameParts { |
| 16 base::string16 given; | 16 base::string16 given; |
| 17 base::string16 middle; | 17 base::string16 middle; |
| 18 base::string16 family; | 18 base::string16 family; |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 // Used to map Chrome card types to Payment Request API basic card payment spec | 21 // Used to map Chrome card types to Payment Request API basic card payment spec |
| 22 // types and icons. https://w3c.github.io/webpayments-methods-card/#method-id | 22 // types and icons. https://w3c.github.io/webpayments-methods-card/#method-id |
| 23 struct PaymentRequestData { | 23 struct PaymentRequestData { |
| 24 const char* card_type; | 24 const char* card_type; |
| 25 const char* basic_card_payment_type; | 25 const char* basic_card_payment_type; |
| 26 const int icon_resource_id; | 26 const int icon_resource_id; |
| 27 const int a11y_label_resource_id; |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 // Returns true if |name| looks like a CJK name (or some kind of mish-mash of | 30 // Returns true if |name| looks like a CJK name (or some kind of mish-mash of |
| 30 // the three, at least). | 31 // the three, at least). |
| 31 bool IsCJKName(base::StringPiece16 name); | 32 bool IsCJKName(base::StringPiece16 name); |
| 32 | 33 |
| 33 // TODO(crbug.com/586510): Investigate the use of app_locale to do better name | 34 // TODO(crbug.com/586510): Investigate the use of app_locale to do better name |
| 34 // splitting. | 35 // splitting. |
| 35 // Returns the different name parts (given, middle and family names) of the full | 36 // Returns the different name parts (given, middle and family names) of the full |
| 36 // |name| passed as a parameter. | 37 // |name| passed as a parameter. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 const PaymentRequestData& GetPaymentRequestData(const std::string& type); | 54 const PaymentRequestData& GetPaymentRequestData(const std::string& type); |
| 54 | 55 |
| 55 // Returns the autofill credit card type string for the provided Payment Request | 56 // Returns the autofill credit card type string for the provided Payment Request |
| 56 // API basic card payment spec |type|. | 57 // API basic card payment spec |type|. |
| 57 const char* GetCardTypeForBasicCardPaymentType(const std::string& type); | 58 const char* GetCardTypeForBasicCardPaymentType(const std::string& type); |
| 58 | 59 |
| 59 } // namespace data_util | 60 } // namespace data_util |
| 60 } // namespace autofill | 61 } // namespace autofill |
| 61 | 62 |
| 62 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_ | 63 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DATA_UTIL_H_ |
| OLD | NEW |