| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 74 |
| 74 // Represents formatting options for each of the different contexts in which an | 75 // Represents formatting options for each of the different contexts in which an |
| 75 // Address label may be displayed. | 76 // Address label may be displayed. |
| 76 enum class AddressStyleType { SUMMARY, DETAILED }; | 77 enum class AddressStyleType { SUMMARY, DETAILED }; |
| 77 | 78 |
| 78 // Extracts and formats descriptive text from the given |profile| to represent | 79 // Extracts and formats descriptive text from the given |profile| to represent |
| 79 // the address in the context specified by |type|. | 80 // the address in the context specified by |type|. |
| 80 std::unique_ptr<views::View> GetShippingAddressLabel( | 81 std::unique_ptr<views::View> GetShippingAddressLabel( |
| 81 AddressStyleType type, | 82 AddressStyleType type, |
| 82 const std::string& locale, | 83 const std::string& locale, |
| 83 const autofill::AutofillProfile& profile); | 84 const autofill::AutofillProfile& profile, |
| 85 const PaymentOptionsProvider& options, |
| 86 const PaymentsProfileComparator& comp); |
| 84 | 87 |
| 85 // Extracts and formats descriptive text from the given |profile| to represent | 88 // Extracts and formats descriptive text from the given |profile| to represent |
| 86 // the contact info in the context specified by |type|. Includes/excludes name, | 89 // the contact info in the context specified by |type|. Includes/excludes name, |
| 87 // email, and phone fields according to the respective boolean fields. | 90 // email, and phone fields according to the respective boolean fields. |
| 88 std::unique_ptr<views::View> GetContactInfoLabel( | 91 std::unique_ptr<views::View> GetContactInfoLabel( |
| 89 AddressStyleType type, | 92 AddressStyleType type, |
| 90 const std::string& locale, | 93 const std::string& locale, |
| 91 const autofill::AutofillProfile& profile, | 94 const autofill::AutofillProfile& profile, |
| 92 const PaymentOptionsProvider& options); | 95 const PaymentOptionsProvider& options, |
| 96 const PaymentsProfileComparator& comp); |
| 93 | 97 |
| 94 // Creates a views::Border object that can paint the gray horizontal ruler used | 98 // Creates a views::Border object that can paint the gray horizontal ruler used |
| 95 // as a separator between items in the Payment Request dialog. | 99 // as a separator between items in the Payment Request dialog. |
| 96 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); | 100 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); |
| 97 | 101 |
| 98 // Creates a label with a bold font. | 102 // Creates a label with a bold font. |
| 99 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); | 103 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); |
| 100 | 104 |
| 101 std::unique_ptr<views::View> CreateShippingOptionLabel( | 105 std::unique_ptr<views::View> CreateShippingOptionLabel( |
| 102 payments::mojom::PaymentShippingOption* shipping_option, | 106 payments::mojom::PaymentShippingOption* shipping_option, |
| 103 const base::string16& formatted_amount); | 107 const base::string16& formatted_amount); |
| 104 | 108 |
| 105 } // namespace payments | 109 } // namespace payments |
| 106 | 110 |
| 107 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 111 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| OLD | NEW |