| 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 CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "components/payments/content/payment_request.mojom.h" | 12 #include "components/payments/content/payment_request.mojom.h" |
| 13 | 13 |
| 14 namespace autofill { | 14 namespace autofill { |
| 15 class AutofillProfile; | 15 class AutofillProfile; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 class Border; | 19 class Border; |
| 20 class ButtonListener; | 20 class ButtonListener; |
| 21 class ImageView; | 21 class ImageView; |
| 22 class Label; | 22 class Label; |
| 23 class View; | 23 class View; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace payments { | 26 namespace payments { |
| 27 | 27 |
| 28 class PaymentOptionsProvider; |
| 29 enum class PaymentShippingType; |
| 30 |
| 28 constexpr int kPaymentRequestRowHorizontalInsets = 16; | 31 constexpr int kPaymentRequestRowHorizontalInsets = 16; |
| 29 constexpr int kPaymentRequestRowVerticalInsets = 8; | 32 constexpr int kPaymentRequestRowVerticalInsets = 8; |
| 30 | 33 |
| 31 // Extra inset relative to the header when a right edge should line up with the | 34 // Extra inset relative to the header when a right edge should line up with the |
| 32 // close button's X rather than its invisible right edge. | 35 // close button's X rather than its invisible right edge. |
| 33 constexpr int kPaymentRequestRowExtraRightInset = 8; | 36 constexpr int kPaymentRequestRowExtraRightInset = 8; |
| 34 constexpr int kPaymentRequestButtonSpacing = 10; | 37 constexpr int kPaymentRequestButtonSpacing = 10; |
| 35 | 38 |
| 36 enum class PaymentRequestCommonTags { | 39 enum class PaymentRequestCommonTags { |
| 37 BACK_BUTTON_TAG = 0, | 40 BACK_BUTTON_TAG = 0, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const std::string& locale, | 76 const std::string& locale, |
| 74 const autofill::AutofillProfile& profile); | 77 const autofill::AutofillProfile& profile); |
| 75 | 78 |
| 76 // Extracts and formats descriptive text from the given |profile| to represent | 79 // Extracts and formats descriptive text from the given |profile| to represent |
| 77 // the contact info in the context specified by |type|. Includes/excludes name, | 80 // the contact info in the context specified by |type|. Includes/excludes name, |
| 78 // email, and phone fields according to the respective boolean fields. | 81 // email, and phone fields according to the respective boolean fields. |
| 79 std::unique_ptr<views::View> GetContactInfoLabel( | 82 std::unique_ptr<views::View> GetContactInfoLabel( |
| 80 AddressStyleType type, | 83 AddressStyleType type, |
| 81 const std::string& locale, | 84 const std::string& locale, |
| 82 const autofill::AutofillProfile& profile, | 85 const autofill::AutofillProfile& profile, |
| 83 bool show_payer_name, | 86 const PaymentOptionsProvider& options); |
| 84 bool show_payer_phone, | |
| 85 bool show_payer_email); | |
| 86 | 87 |
| 87 // Creates a views::Border object that can paint the gray horizontal ruler used | 88 // Creates a views::Border object that can paint the gray horizontal ruler used |
| 88 // as a separator between items in the Payment Request dialog. | 89 // as a separator between items in the Payment Request dialog. |
| 89 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); | 90 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); |
| 90 | 91 |
| 91 // Creates a label with a bold font. | 92 // Creates a label with a bold font. |
| 92 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); | 93 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); |
| 93 | 94 |
| 94 base::string16 GetShippingAddressSectionString( | 95 base::string16 GetShippingAddressSectionString( |
| 95 payments::mojom::PaymentShippingType shipping_type); | 96 PaymentShippingType shipping_type); |
| 96 base::string16 GetShippingOptionSectionString( | 97 base::string16 GetShippingOptionSectionString( |
| 97 payments::mojom::PaymentShippingType shipping_type); | 98 PaymentShippingType shipping_type); |
| 98 | 99 |
| 99 std::unique_ptr<views::View> CreateShippingOptionLabel( | 100 std::unique_ptr<views::View> CreateShippingOptionLabel( |
| 100 payments::mojom::PaymentShippingOption* shipping_option, | 101 payments::mojom::PaymentShippingOption* shipping_option, |
| 101 const base::string16& formatted_amount); | 102 const base::string16& formatted_amount); |
| 102 | 103 |
| 103 } // namespace payments | 104 } // namespace payments |
| 104 | 105 |
| 105 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 106 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| OLD | NEW |