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

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

Issue 2621153002: [WebPayments] Add the Payment Method section in the Payment Sheet (Closed)
Patch Set: Initial patch 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_method_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0228c8ce500f3540d3fe7944bb469bf9e7d18a2f
--- /dev/null
+++ b/chrome/browser/ui/views/payments/payment_method_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_method_view_controller.h"
+
+#include <memory>
+#include <utility>
+
+#include "base/logging.h"
+#include "base/memory/ptr_util.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 "components/payments/payment_request.h"
+#include "components/strings/grit/components_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/views/controls/label.h"
Mathieu 2017/01/12 21:27:10 need?
anthonyvd 2017/01/13 16:09:18 Nope, done.
+#include "ui/views/layout/grid_layout.h"
+#include "ui/views/view.h"
+
+namespace payments {
+
+PaymentMethodViewController::PaymentMethodViewController(
+ PaymentRequest* request, PaymentRequestDialog* dialog)
please use gerrit instead 2017/01/12 19:34:02 Parameter names should match in header and source.
anthonyvd 2017/01/13 16:09:18 Done.
+ : PaymentRequestSheetController(request, dialog) {}
+
+PaymentMethodViewController::~PaymentMethodViewController() {}
+
+std::unique_ptr<views::View> PaymentMethodViewController::CreateView() {
+ std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>();
+
+ // TODO(anthonyvd): populate this view.
+
+ return payments::CreatePaymentView(
Mathieu 2017/01/12 21:27:10 do you need payments:: ?
anthonyvd 2017/01/13 16:09:18 Nope, done.
+ CreateSheetHeaderView(
+ true,
+ l10n_util::GetStringUTF16(
+ IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME),
+ this),
+ std::move(content_view));
+}
+
+void PaymentMethodViewController::ButtonPressed(
+ views::Button* sender, const ui::Event& event) {
+ switch (sender->tag()) {
+ case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG):
+ dialog()->CloseDialog();
+ break;
+ case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG):
+ dialog()->GoBack();
+ break;
+ default:
+ NOTREACHED();
+ }
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698