Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1749)

Unified Diff: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc

Issue 2747943004: [Web Payments] Add the shipping options sheet. (Closed)
Patch Set: Address comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 39a5c2a42f57ceefac37c8f25c9c693701ed63ee..52d3f1c0b13afd7c6023eb1505c4db6993936f64 100644
--- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -301,6 +301,11 @@ void PaymentSheetViewController::ButtonPressed(
dialog()->ShowContactProfileSheet();
break;
+ case static_cast<int>(
+ PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON):
+ dialog()->ShowShippingOptionSheet();
+ break;
+
default:
PaymentRequestSheetController::ButtonPressed(sender, event);
break;
@@ -503,34 +508,17 @@ PaymentSheetViewController::CreateContactInfoRow() {
return section;
}
-std::unique_ptr<views::View>
-PaymentSheetViewController::CreateShippingOptionContent() {
- 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());
-
- payments::mojom::PaymentShippingOption* selected_shipping_option =
- request()->selected_shipping_option();
- if (selected_shipping_option) {
- container->AddChildView(
- new views::Label(base::ASCIIToUTF16(selected_shipping_option->label)));
- container->AddChildView(
- new views::Label(request()->GetFormattedCurrencyAmount(
- selected_shipping_option->amount->value)));
- }
-
- return container;
-}
-
std::unique_ptr<views::Button>
PaymentSheetViewController::CreateShippingOptionRow() {
+ payments::mojom::PaymentShippingOption* selected_option =
+ request()->selected_shipping_option();
+ std::unique_ptr<views::View> option_label = CreateShippingOptionLabel(
+ selected_option, selected_option ? request()->GetFormattedCurrencyAmount(
+ selected_option->amount->value)
+ : base::ASCIIToUTF16(""));
std::unique_ptr<views::Button> section = CreatePaymentSheetRow(
this, GetShippingOptionSectionString(request()->options()->shipping_type),
- CreateShippingOptionContent(), std::unique_ptr<views::View>(nullptr),
+ std::move(option_label), std::unique_ptr<views::View>(nullptr),
widest_name_column_view_width_);
section->set_tag(static_cast<int>(
PaymentSheetViewControllerTags::SHOW_SHIPPING_OPTION_BUTTON));

Powered by Google App Engine
This is Rietveld 408576698