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