Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc |
| diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc |
| index 80043e1f9d6440c5a21280f25fe8bead9d8372c5..5104a00e58e51d8f0e5e8712654d98bd9d1e757b 100644 |
| --- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc |
| +++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc |
| @@ -57,6 +57,7 @@ enum class PaymentSheetViewControllerTags { |
| SHOW_SHIPPING_BUTTON, |
| SHOW_PAYMENT_METHOD_BUTTON, |
| SHOW_CONTACT_INFO_BUTTON, |
| + SHOW_SHIPPING_METHOD_BUTTON, |
| PAY_BUTTON |
| }; |
| @@ -215,6 +216,8 @@ std::unique_ptr<views::View> PaymentSheetViewController::CreateView() { |
| if (request()->request_shipping()) { |
| layout->StartRow(0, 0); |
| layout->AddView(CreateShippingRow().release()); |
| + layout->StartRow(0, 0); |
| + layout->AddView(CreateShippingMethodRow().release()); |
| } |
| layout->StartRow(0, 0); |
| layout->AddView(CreatePaymentMethodRow().release()); |
| @@ -500,4 +503,40 @@ PaymentSheetViewController::CreateContactInfoRow() { |
| return section; |
| } |
| +std::unique_ptr<views::View> |
| +PaymentSheetViewController::CreateShippingMethodContent() { |
| + std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
| + |
| + std::unique_ptr<views::BoxLayout> layout = |
| + base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, 0, 0); |
| + layout->set_cross_axis_alignment( |
| + views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| + container->SetLayoutManager(layout.release()); |
| + |
| + if (request()->selected_shipping_option()) { |
|
Mathieu
2017/03/09 19:07:03
pull this out first since it's being reused 3 time
anthonyvd
2017/03/09 19:43:55
Done.
|
| + container->AddChildView(new views::Label( |
| + base::ASCIIToUTF16(request()->selected_shipping_option()->label))); |
| + container->AddChildView( |
| + new views::Label(request()->GetFormattedCurrencyAmount( |
| + request()->selected_shipping_option()->amount->value))); |
| + } |
| + |
| + return container; |
| +} |
| + |
| +std::unique_ptr<views::Button> |
| +PaymentSheetViewController::CreateShippingMethodRow() { |
| + std::unique_ptr<views::Button> section = CreatePaymentSheetRow( |
| + this, |
| + l10n_util::GetStringUTF16( |
| + IDS_PAYMENT_REQUEST_SHIPPING_METHOD_SECTION_NAME), |
| + CreateShippingMethodContent(), std::unique_ptr<views::View>(nullptr), |
| + widest_name_column_view_width_); |
| + section->set_tag(static_cast<int>( |
| + PaymentSheetViewControllerTags::SHOW_SHIPPING_METHOD_BUTTON)); |
| + section->set_id( |
| + static_cast<int>(DialogViewID::PAYMENT_SHEET_SHIPPING_METHOD_SECTION)); |
| + return section; |
| +} |
| + |
| } // namespace payments |