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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 int icon_resource_id, | 71 int icon_resource_id, |
72 const base::string16& tooltip_text); | 72 const base::string16& tooltip_text); |
73 | 73 |
74 std::unique_ptr<views::View> CreateProductLogoFooterView(); | 74 std::unique_ptr<views::View> CreateProductLogoFooterView(); |
75 | 75 |
76 // 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 |
77 // Address label may be displayed. | 77 // Address label may be displayed. |
78 enum class AddressStyleType { SUMMARY, DETAILED }; | 78 enum class AddressStyleType { SUMMARY, DETAILED }; |
79 | 79 |
80 // Extracts and formats descriptive text from the given |profile| to represent | 80 // Extracts and formats descriptive text from the given |profile| to represent |
81 // the address in the context specified by |type|. | 81 // the address in the context specified by |type|. If |error| is specified, |
82 std::unique_ptr<views::View> GetShippingAddressLabel( | 82 // this will display it as the last item in an error state. |disabled_state| |
| 83 // will make the various label lines look disabled. |
| 84 std::unique_ptr<views::View> GetShippingAddressLabelWithError( |
83 AddressStyleType type, | 85 AddressStyleType type, |
84 const std::string& locale, | 86 const std::string& locale, |
85 const autofill::AutofillProfile& profile, | 87 const autofill::AutofillProfile& profile, |
86 const PaymentOptionsProvider& options, | 88 const base::string16& error, |
| 89 bool disabled_state); |
| 90 |
| 91 // Extracts and formats descriptive text from the given |profile| to represent |
| 92 // the address in the context specified by |type|. The missing information will |
| 93 // be computed using |comp| and displayed as the last line in an informative |
| 94 // manner. |
| 95 std::unique_ptr<views::View> GetShippingAddressLabelWithMissingInfo( |
| 96 AddressStyleType type, |
| 97 const std::string& locale, |
| 98 const autofill::AutofillProfile& profile, |
87 const PaymentsProfileComparator& comp); | 99 const PaymentsProfileComparator& comp); |
88 | 100 |
89 // Extracts and formats descriptive text from the given |profile| to represent | 101 // Extracts and formats descriptive text from the given |profile| to represent |
90 // the contact info in the context specified by |type|. Includes/excludes name, | 102 // the contact info in the context specified by |type|. Includes/excludes name, |
91 // email, and phone fields according to the respective boolean fields. | 103 // email, and phone fields according to the respective boolean fields. |
92 std::unique_ptr<views::View> GetContactInfoLabel( | 104 std::unique_ptr<views::View> GetContactInfoLabel( |
93 AddressStyleType type, | 105 AddressStyleType type, |
94 const std::string& locale, | 106 const std::string& locale, |
95 const autofill::AutofillProfile& profile, | 107 const autofill::AutofillProfile& profile, |
96 const PaymentOptionsProvider& options, | 108 const PaymentOptionsProvider& options, |
97 const PaymentsProfileComparator& comp); | 109 const PaymentsProfileComparator& comp); |
98 | 110 |
99 // Creates a views::Border object that can paint the gray horizontal ruler used | 111 // Creates a views::Border object that can paint the gray horizontal ruler used |
100 // as a separator between items in the Payment Request dialog. | 112 // as a separator between items in the Payment Request dialog. |
101 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); | 113 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); |
102 | 114 |
103 // Creates a label with a bold font. | 115 // Creates a label with a bold font. |
104 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); | 116 std::unique_ptr<views::Label> CreateBoldLabel(const base::string16& text); |
105 | 117 |
106 std::unique_ptr<views::View> CreateShippingOptionLabel( | 118 std::unique_ptr<views::View> CreateShippingOptionLabel( |
107 payments::mojom::PaymentShippingOption* shipping_option, | 119 payments::mojom::PaymentShippingOption* shipping_option, |
108 const base::string16& formatted_amount); | 120 const base::string16& formatted_amount); |
109 | 121 |
110 } // namespace payments | 122 } // namespace payments |
111 | 123 |
112 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 124 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
OLD | NEW |