| 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/mojom/payment_request.mojom.h" | 12 #include "components/payments/mojom/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; | 28 class PaymentOptionsProvider; |
| 29 class PaymentsProfileComparator; |
| 29 enum class PaymentShippingType; | 30 enum class PaymentShippingType; |
| 30 | 31 |
| 31 constexpr int kPaymentRequestRowHorizontalInsets = 16; | 32 constexpr int kPaymentRequestRowHorizontalInsets = 16; |
| 32 constexpr int kPaymentRequestRowVerticalInsets = 8; | 33 constexpr int kPaymentRequestRowVerticalInsets = 8; |
| 33 | 34 |
| 34 // Extra inset relative to the header when a right edge should line up with the | 35 // Extra inset relative to the header when a right edge should line up with the |
| 35 // close button's X rather than its invisible right edge. | 36 // close button's X rather than its invisible right edge. |
| 36 constexpr int kPaymentRequestRowExtraRightInset = 8; | 37 constexpr int kPaymentRequestRowExtraRightInset = 8; |
| 37 constexpr int kPaymentRequestButtonSpacing = 10; | 38 constexpr int kPaymentRequestButtonSpacing = 10; |
| 38 | 39 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 // Represents formatting options for each of the different contexts in which an | 76 // Represents formatting options for each of the different contexts in which an |
| 76 // Address label may be displayed. | 77 // Address label may be displayed. |
| 77 enum class AddressStyleType { SUMMARY, DETAILED }; | 78 enum class AddressStyleType { SUMMARY, DETAILED }; |
| 78 | 79 |
| 79 // Extracts and formats descriptive text from the given |profile| to represent | 80 // Extracts and formats descriptive text from the given |profile| to represent |
| 80 // the address in the context specified by |type|. | 81 // the address in the context specified by |type|. |
| 81 std::unique_ptr<views::View> GetShippingAddressLabel( | 82 std::unique_ptr<views::View> GetShippingAddressLabel( |
| 82 AddressStyleType type, | 83 AddressStyleType type, |
| 83 const std::string& locale, | 84 const std::string& locale, |
| 84 const autofill::AutofillProfile& profile); | 85 const autofill::AutofillProfile& profile, |
| 86 const PaymentOptionsProvider& options, |
| 87 const PaymentsProfileComparator& comp); |
| 85 | 88 |
| 86 // Extracts and formats descriptive text from the given |profile| to represent | 89 // Extracts and formats descriptive text from the given |profile| to represent |
| 87 // the contact info in the context specified by |type|. Includes/excludes name, | 90 // the contact info in the context specified by |type|. Includes/excludes name, |
| 88 // email, and phone fields according to the respective boolean fields. | 91 // email, and phone fields according to the respective boolean fields. |
| 89 std::unique_ptr<views::View> GetContactInfoLabel( | 92 std::unique_ptr<views::View> GetContactInfoLabel( |
| 90 AddressStyleType type, | 93 AddressStyleType type, |
| 91 const std::string& locale, | 94 const std::string& locale, |
| 92 const autofill::AutofillProfile& profile, | 95 const autofill::AutofillProfile& profile, |
| 93 const PaymentOptionsProvider& options); | 96 const PaymentOptionsProvider& options, |
| 97 const PaymentsProfileComparator& comp); |
| 94 | 98 |
| 95 // Creates a views::Border object that can paint the gray horizontal ruler used | 99 // Creates a views::Border object that can paint the gray horizontal ruler used |
| 96 // as a separator between items in the Payment Request dialog. | 100 // as a separator between items in the Payment Request dialog. |
| 97 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); | 101 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); |
| 98 | 102 |
| 99 // Creates a label with a bold font. | 103 // Creates a label with a bold font. |
| 100 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); | 104 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); |
| 101 | 105 |
| 102 std::unique_ptr<views::View> CreateShippingOptionLabel( | 106 std::unique_ptr<views::View> CreateShippingOptionLabel( |
| 103 payments::mojom::PaymentShippingOption* shipping_option, | 107 payments::mojom::PaymentShippingOption* shipping_option, |
| 104 const base::string16& formatted_amount); | 108 const base::string16& formatted_amount); |
| 105 | 109 |
| 106 } // namespace payments | 110 } // namespace payments |
| 107 | 111 |
| 108 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 112 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| OLD | NEW |