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

Side by Side Diff: components/payments/core/payment_request_data_util.h

Issue 2949813003: [Payment Request] Formats phone number and credit card number in editors. (Closed)
Patch Set: Fixed broken tests Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ 5 #ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_
6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const std::string& country_code); 64 const std::string& country_code);
65 65
66 // Formats the given number |phone_number| to 66 // Formats the given number |phone_number| to
67 // i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::E164 format by using 67 // i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::E164 format by using
68 // i18n::phonenumbers::PhoneNumberUtil::Format, as defined in the Payment 68 // i18n::phonenumbers::PhoneNumberUtil::Format, as defined in the Payment
69 // Request spec 69 // Request spec
70 // (https://w3c.github.io/browser-payment-api/#paymentrequest-updated-algorithm) 70 // (https://w3c.github.io/browser-payment-api/#paymentrequest-updated-algorithm)
71 std::string FormatPhoneForResponse(const std::string& phone_number, 71 std::string FormatPhoneForResponse(const std::string& phone_number,
72 const std::string& country_code); 72 const std::string& country_code);
73 73
74 // Formats |card_number| for display. For example, "4111111111111111" is
75 // formatted into "4111 1111 1111 1111". This method does not format masked card
76 // numbers, which start with a letter.
77 base::string16 FormatCardNumberForDisplay(const base::string16& card_number);
78
74 // Returns a country code to be used when validating this profile. If the 79 // Returns a country code to be used when validating this profile. If the
75 // profile has a valid country code set, it is returned. If not, a country code 80 // profile has a valid country code set, it is returned. If not, a country code
76 // associated with |app_locale| is used as a fallback. 81 // associated with |app_locale| is used as a fallback.
77 std::string GetCountryCodeWithFallback(const autofill::AutofillProfile* profile, 82 std::string GetCountryCodeWithFallback(const autofill::AutofillProfile* profile,
78 const std::string& app_locale); 83 const std::string& app_locale);
79 84
80 } // namespace data_util 85 } // namespace data_util
81 } // namespace payments 86 } // namespace payments
82 87
83 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_ 88 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698