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

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

Issue 2625183002: [WebPayments] Adding Shipping Address and Contact Info display to order summary (Closed)
Patch Set: Created 3 years, 11 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 d085b26e922c1f849152ad1e20dd51d91c05c81e..03d5093ba72309685df1fde8fe0c50d9436af6ed 100644
--- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -8,7 +8,9 @@
#include <utility>
#include "base/memory/ptr_util.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/views/payments/payment_request_address_util.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog.h"
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "chrome/grit/generated_resources.h"
@@ -35,10 +37,13 @@
namespace payments {
namespace {
+constexpr int kFirstTagValue = static_cast<int>(
+ payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX);
+
enum class PaymentSheetViewControllerTags {
// The tag for the button that navigates to the Order Summary sheet.
- SHOW_ORDER_SUMMARY_BUTTON = static_cast<int>(
- payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX),
+ SHOW_ORDER_SUMMARY_BUTTON = kFirstTagValue,
+ SHOW_SHIPPING_BUTTON = kFirstTagValue + 1,
anthonyvd 2017/01/12 15:42:11 No need for the explicit value on enum members aft
tmartino 2017/01/18 17:28:24 Done
};
// Creates a clickable row to be displayed in the Payment Sheet. It contains
@@ -108,6 +113,7 @@ class PaymentSheetRow : public views::CustomButton {
layout->AddView(chevron);
}
+ private:
DISALLOW_COPY_AND_ASSIGN(PaymentSheetRow);
};
@@ -132,6 +138,9 @@ std::unique_ptr<views::View> PaymentSheetViewController::CreateView() {
layout->StartRow(0, 0);
layout->AddView(CreatePaymentSheetSummaryRow().release());
+ layout->StartRow(1, 0);
anthonyvd 2017/01/12 15:42:11 Do you have the first parameter here set to 0 on p
tmartino 2017/01/18 17:28:24 It doesn't have that effect here; the new row appe
+ layout->AddView(CreatePaymentSheetShippingRow().release());
+
return CreatePaymentView(
CreateSheetHeaderView(
false,
@@ -150,6 +159,9 @@ void PaymentSheetViewController::ButtonPressed(
PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON):
dialog()->ShowOrderSummary();
break;
+ case static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON):
+ // TODO(tmartino): Transition to shipping page once it exists.
+ break;
default:
NOTREACHED();
}
@@ -178,4 +190,21 @@ PaymentSheetViewController::CreatePaymentSheetSummaryRow() {
return section;
}
+std::unique_ptr<views::View>
+PaymentSheetViewController::CreateShippingSectionContent() {
+ return payments::GetPaymentRequestAddressLabel(
+ AddressFormatType::SHIPPING_SUMMARY, "", GetDummyProfile().get());
anthonyvd 2017/01/12 15:42:11 GetDummyProfile().get() here would likely delete t
tmartino 2017/01/18 17:28:24 Done (per your other suggestion)
+}
+
+std::unique_ptr<views::Button>
+PaymentSheetViewController::CreatePaymentSheetShippingRow() {
+ std::unique_ptr<views::Button> section = base::MakeUnique<PaymentSheetRow>(
+ this,
+ l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_SHIPPING_SECTION_NAME),
+ CreateShippingSectionContent(), std::unique_ptr<views::View>(nullptr));
+ section->set_tag(
+ static_cast<int>(PaymentSheetViewControllerTags::SHOW_SHIPPING_BUTTON));
+ return section;
+}
+
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698