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

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

Issue 2579513002: [WebPayments] Factor out sheet-specific logic in Controllers. (Closed)
Patch Set: Address comments. Created 4 years 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
new file mode 100644
index 0000000000000000000000000000000000000000..6d33c128e3cc2dc4fe61e03dd6e2286945cf7085
--- /dev/null
+++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
+
+#include "base/strings/utf_string_conversions.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"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/views/controls/button/md_text_button.h"
+#include "ui/views/layout/grid_layout.h"
+
+namespace {
+
+// The tag for the button that navigates to the Order Summary sheet.
+constexpr int kOrderSummaryTag = 0;
+
+}
please use gerrit instead 2016/12/15 19:11:15 You've placed "// namespace" comment in the other
anthonyvd 2016/12/15 19:55:07 Done.
+
+namespace payments {
+
+PaymentSheetViewController::PaymentSheetViewController(
+ PaymentRequestImpl* impl, PaymentRequestDialog* dialog)
+ : PaymentRequestSheetController(impl, dialog) {}
+
+PaymentSheetViewController::~PaymentSheetViewController() {}
+
+std::unique_ptr<views::View> PaymentSheetViewController::CreateView() {
+ views::View* content_view = new views::View;
please use gerrit instead 2016/12/15 19:11:15 #include "ui/views/view.h"
anthonyvd 2016/12/15 19:55:07 Done.
+
+ views::GridLayout* layout = new views::GridLayout(content_view);
+ content_view->SetLayoutManager(layout);
+ views::ColumnSet* columns = layout->AddColumnSet(0);
+ columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
+ 0, views::GridLayout::USE_PREF, 0, 0);
+
+ layout->StartRow(0, 0);
+ views::LabelButton* order_summary_button =
please use gerrit instead 2016/12/15 19:11:15 #include "ui/views/controls/button/label_button.h"
anthonyvd 2016/12/15 19:55:06 Done.
+ views::MdTextButton::CreateSecondaryUiBlueButton(
+ this, base::ASCIIToUTF16("Order Summary"));
please use gerrit instead 2016/12/15 19:11:15 Don't forget to i18n this eventually. This is a bu
anthonyvd 2016/12/15 19:55:07 Yep, this will eventually be replaced by the entir
+ order_summary_button->set_tag(kOrderSummaryTag);
+ layout->AddView(order_summary_button);
+
+ return payments::CreatePaymentView(
+ l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE),
please use gerrit instead 2016/12/15 19:11:15 Drive-by: move this to autofill_strings.grdp.
anthonyvd 2016/12/15 19:55:06 Will do.
+ content_view);
+}
+
+void PaymentSheetViewController::ButtonPressed(
+ views::Button* sender, const ui::Event& event) {
+ DCHECK_EQ(kOrderSummaryTag, sender->tag());
+
+ dialog()->ShowOrderSummary();
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698