| 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 IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/payments/core/payment_options_provider.h" | 13 #include "components/payments/core/payment_options_provider.h" |
| 14 | 14 |
| 15 namespace autofill { | 15 namespace autofill { |
| 16 class AutofillProfile; | 16 class AutofillProfile; |
| 17 } // namespace autofill | 17 } // namespace autofill |
| 18 | 18 |
| 19 namespace payments { | 19 namespace payments { |
| 20 class PaymentInstrument; | 20 class PaymentInstrument; |
| 21 class PaymentRequest; |
| 21 } // namespace payments | 22 } // namespace payments |
| 22 | 23 |
| 23 class PaymentRequest; | |
| 24 | |
| 25 namespace payment_request_util { | 24 namespace payment_request_util { |
| 26 | 25 |
| 27 // Helper function to create a name label from an autofill profile. Returns nil | 26 // Helper function to create a name label from an autofill profile. Returns nil |
| 28 // if the resulting label is empty. | 27 // if the resulting label is empty. |
| 29 NSString* GetNameLabelFromAutofillProfile( | 28 NSString* GetNameLabelFromAutofillProfile( |
| 30 const autofill::AutofillProfile& profile); | 29 const autofill::AutofillProfile& profile); |
| 31 | 30 |
| 32 // Helper function to create a shipping address label from an autofill profile. | 31 // Helper function to create a shipping address label from an autofill profile. |
| 33 // Returns nil if the resulting label is empty. | 32 // Returns nil if the resulting label is empty. |
| 34 NSString* GetShippingAddressLabelFromAutofillProfile( | 33 NSString* GetShippingAddressLabelFromAutofillProfile( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 const autofill::AutofillProfile& profile); | 44 const autofill::AutofillProfile& profile); |
| 46 | 45 |
| 47 // Helper function to create an email label from an autofill profile. Returns | 46 // Helper function to create an email label from an autofill profile. Returns |
| 48 // nil if the resulting label is empty. | 47 // nil if the resulting label is empty. |
| 49 NSString* GetEmailLabelFromAutofillProfile( | 48 NSString* GetEmailLabelFromAutofillProfile( |
| 50 const autofill::AutofillProfile& profile); | 49 const autofill::AutofillProfile& profile); |
| 51 | 50 |
| 52 // Helper function to create a notification label for an address cell from an | 51 // Helper function to create a notification label for an address cell from an |
| 53 // autofill profile. Returns nil if the resulting label is empty. | 52 // autofill profile. Returns nil if the resulting label is empty. |
| 54 NSString* GetAddressNotificationLabelFromAutofillProfile( | 53 NSString* GetAddressNotificationLabelFromAutofillProfile( |
| 55 PaymentRequest& payment_request, | 54 payments::PaymentRequest& payment_request, |
| 56 const autofill::AutofillProfile& profile); | 55 const autofill::AutofillProfile& profile); |
| 57 | 56 |
| 58 // Helper function to create a notification label for what's missing from a | 57 // Helper function to create a notification label for what's missing from a |
| 59 // payment method. Returns nil if the resulting label is empty. | 58 // payment method. Returns nil if the resulting label is empty. |
| 60 NSString* GetPaymentMethodNotificationLabelFromPaymentMethod( | 59 NSString* GetPaymentMethodNotificationLabelFromPaymentMethod( |
| 61 payments::PaymentInstrument& payment_method, | 60 payments::PaymentInstrument& payment_method, |
| 62 const std::vector<autofill::AutofillProfile*>& billing_profiles); | 61 const std::vector<autofill::AutofillProfile*>& billing_profiles); |
| 63 | 62 |
| 64 // Returns the title for the shipping section of the payment summary view given | 63 // Returns the title for the shipping section of the payment summary view given |
| 65 // the shipping type specified in |payment_request|. | 64 // the shipping type specified in |payment_request|. |
| 66 NSString* GetShippingSectionTitle(payments::PaymentShippingType shipping_type); | 65 NSString* GetShippingSectionTitle(payments::PaymentShippingType shipping_type); |
| 67 | 66 |
| 68 // Returns the error message to be displayed in the shipping address selection | 67 // Returns the error message to be displayed in the shipping address selection |
| 69 // view given the shipping type specified in |payment_request|. | 68 // view given the shipping type specified in |payment_request|. |
| 70 NSString* GetShippingAddressSelectorErrorMessage( | 69 NSString* GetShippingAddressSelectorErrorMessage( |
| 71 const PaymentRequest& payment_request); | 70 const payments::PaymentRequest& payment_request); |
| 72 | 71 |
| 73 // Returns the error message to be displayed in the shipping option selection | 72 // Returns the error message to be displayed in the shipping option selection |
| 74 // view given the shipping type specified in |payment_request|. | 73 // view given the shipping type specified in |payment_request|. |
| 75 NSString* GetShippingOptionSelectorErrorMessage( | 74 NSString* GetShippingOptionSelectorErrorMessage( |
| 76 const PaymentRequest& payment_request); | 75 const payments::PaymentRequest& payment_request); |
| 77 | 76 |
| 78 } // namespace payment_request_util | 77 } // namespace payment_request_util |
| 79 | 78 |
| 80 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ | 79 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_UTIL_H_ |
| OLD | NEW |