| 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 | 12 |
| 13 namespace autofill { | 13 namespace autofill { |
| 14 class AutofillProfile; | 14 class AutofillProfile; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class Border; | 18 class Border; |
| 19 class ImageView; |
| 19 class VectorIconButtonDelegate; | 20 class VectorIconButtonDelegate; |
| 20 class View; | 21 class View; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace payments { | 24 namespace payments { |
| 24 | 25 |
| 25 constexpr int kPaymentRequestRowHorizontalInsets = 14; | 26 constexpr int kPaymentRequestRowHorizontalInsets = 14; |
| 26 constexpr int kPaymentRequestRowVerticalInsets = 8; | 27 constexpr int kPaymentRequestRowVerticalInsets = 8; |
| 27 | 28 |
| 28 enum class PaymentRequestCommonTags { | 29 enum class PaymentRequestCommonTags { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 // true), a |title| label, and a right-aligned X close button. |delegate| | 40 // true), a |title| label, and a right-aligned X close button. |delegate| |
| 40 // becomes the delegate for the back and close buttons. | 41 // becomes the delegate for the back and close buttons. |
| 41 // +---------------------------+ | 42 // +---------------------------+ |
| 42 // | <- | Title | X | | 43 // | <- | Title | X | |
| 43 // +---------------------------+ | 44 // +---------------------------+ |
| 44 std::unique_ptr<views::View> CreateSheetHeaderView( | 45 std::unique_ptr<views::View> CreateSheetHeaderView( |
| 45 bool show_back_arrow, | 46 bool show_back_arrow, |
| 46 const base::string16& title, | 47 const base::string16& title, |
| 47 views::VectorIconButtonDelegate* delegate); | 48 views::VectorIconButtonDelegate* delegate); |
| 48 | 49 |
| 50 // Returns a card image view for the given |card_type|. Includes a rounded rect |
| 51 // border. Callers need to set the size of the resulting ImageView. |
| 52 std::unique_ptr<views::ImageView> CreateCardIconView( |
| 53 const std::string& card_type); |
| 54 |
| 49 // Represents formatting options for each of the different contexts in which an | 55 // Represents formatting options for each of the different contexts in which an |
| 50 // Address label may be displayed. | 56 // Address label may be displayed. |
| 51 enum class AddressStyleType { SUMMARY, DETAILED }; | 57 enum class AddressStyleType { SUMMARY, DETAILED }; |
| 52 | 58 |
| 53 // Extracts and formats descriptive text from the given |profile| to represent | 59 // Extracts and formats descriptive text from the given |profile| to represent |
| 54 // the address in the context specified by |type|. | 60 // the address in the context specified by |type|. |
| 55 std::unique_ptr<views::View> GetShippingAddressLabel( | 61 std::unique_ptr<views::View> GetShippingAddressLabel( |
| 56 AddressStyleType type, | 62 AddressStyleType type, |
| 57 const std::string& locale, | 63 const std::string& locale, |
| 58 const autofill::AutofillProfile& profile); | 64 const autofill::AutofillProfile& profile); |
| 59 | 65 |
| 60 // Extracts and formats descriptive text from the given |profile| to represent | 66 // Extracts and formats descriptive text from the given |profile| to represent |
| 61 // the contact info in the context specified by |type|. Includes/excludes name, | 67 // the contact info in the context specified by |type|. Includes/excludes name, |
| 62 // email, and phone fields according to the respective boolean fields. | 68 // email, and phone fields according to the respective boolean fields. |
| 63 std::unique_ptr<views::View> GetContactInfoLabel( | 69 std::unique_ptr<views::View> GetContactInfoLabel( |
| 64 AddressStyleType type, | 70 AddressStyleType type, |
| 65 const std::string& locale, | 71 const std::string& locale, |
| 66 const autofill::AutofillProfile& profile, | 72 const autofill::AutofillProfile& profile, |
| 67 bool show_payer_name, | 73 bool show_payer_name, |
| 68 bool show_payer_email, | 74 bool show_payer_email, |
| 69 bool show_payer_phone); | 75 bool show_payer_phone); |
| 70 | 76 |
| 71 // Creates a views::Border object that can paint the gray horizontal ruler used | 77 // Creates a views::Border object that can paint the gray horizontal ruler used |
| 72 // as a separator between items in the Payment Request dialog. | 78 // as a separator between items in the Payment Request dialog. |
| 73 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); | 79 std::unique_ptr<views::Border> CreatePaymentRequestRowBorder(); |
| 74 | 80 |
| 75 } // namespace payments | 81 } // namespace payments |
| 76 | 82 |
| 77 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ | 83 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_VIEWS_UTIL_H_ |
| OLD | NEW |