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

Side by Side Diff: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc

Issue 2579513002: [WebPayments] Factor out sheet-specific logic in Controllers. (Closed)
Patch Set: Add missing include and semicolon. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6
7 #include <memory>
8 #include <utility>
9
10 #include "base/memory/ptr_util.h"
11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/ui/views/payments/payment_request_dialog.h"
13 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
14 #include "chrome/grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/views/controls/button/label_button.h"
17 #include "ui/views/controls/button/md_text_button.h"
18 #include "ui/views/layout/grid_layout.h"
19 #include "ui/views/view.h"
20
21 namespace {
22
23 // The tag for the button that navigates to the Order Summary sheet.
24 constexpr int kOrderSummaryTag = 0;
25
26 } // namespace
27
28 namespace payments {
29
30 PaymentSheetViewController::PaymentSheetViewController(
31 PaymentRequestImpl* impl, PaymentRequestDialog* dialog)
32 : PaymentRequestSheetController(impl, dialog) {}
33
34 PaymentSheetViewController::~PaymentSheetViewController() {}
35
36 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() {
37 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>();
38
39 views::GridLayout* layout = new views::GridLayout(content_view.get());
40 content_view->SetLayoutManager(layout);
41 views::ColumnSet* columns = layout->AddColumnSet(0);
42 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
43 0, views::GridLayout::USE_PREF, 0, 0);
44
45 layout->StartRow(0, 0);
46 views::LabelButton* order_summary_button =
47 views::MdTextButton::CreateSecondaryUiBlueButton(
48 this, base::ASCIIToUTF16("Order Summary"));
49 order_summary_button->set_tag(kOrderSummaryTag);
50 layout->AddView(order_summary_button);
51
52 return payments::CreatePaymentView(
53 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE),
54 std::move(content_view));
55 }
56
57 void PaymentSheetViewController::ButtonPressed(
58 views::Button* sender, const ui::Event& event) {
59 DCHECK_EQ(kOrderSummaryTag, sender->tag());
60
61 dialog()->ShowOrderSummary();
62 }
63
64 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_sheet_view_controller.h ('k') | chrome/browser/ui/views/payments/view_stack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698