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

Side by Side Diff: chrome/browser/ui/views/payments/order_summary_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 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/order_summary_view_controller.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/payments/payment_request_dialog.h"
9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
10 #include "chrome/grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/controls/button/md_text_button.h"
13 #include "ui/views/layout/grid_layout.h"
14
15 namespace {
16
17 // The tag for the button that navigates back to the payment sheet.
18 constexpr int kBackButtonTag = 0;
19
20 } // namespace
21
22 namespace payments {
23
24 OrderSummaryViewController::OrderSummaryViewController(
25 PaymentRequestImpl* impl, PaymentRequestDialog* dialog)
26 : PaymentRequestSheetController(impl, dialog) {}
27
28 OrderSummaryViewController::~OrderSummaryViewController() {}
29
30 std::unique_ptr<views::View> OrderSummaryViewController::CreateView() {
31 views::View* content_view = new views::View;
please use gerrit instead 2016/12/15 19:11:14 #include "ui/views/view.h"
anthonyvd 2016/12/15 19:55:05 Done.
32
33 views::GridLayout* layout = new views::GridLayout(content_view);
34 content_view->SetLayoutManager(layout);
35 views::ColumnSet* columns = layout->AddColumnSet(0);
36 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
37 0, views::GridLayout::USE_PREF, 0, 0);
38
39 layout->StartRow(0, 0);
40 views::LabelButton* back_button =
please use gerrit instead 2016/12/15 19:11:14 #include "ui/views/controls/button/label_button.h"
anthonyvd 2016/12/15 19:55:05 Done.
41 views::MdTextButton::CreateSecondaryUiBlueButton(
42 this, base::ASCIIToUTF16("Back"));
please use gerrit instead 2016/12/15 19:11:14 Don't forget to properly i18n this eventually.
anthonyvd 2016/12/15 19:55:05 Absolutely, this is going to be an arrow icon ulti
43 back_button->set_tag(kBackButtonTag);
44 layout->AddView(back_button);
45
46 return payments::CreatePaymentView(
47 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE),
please use gerrit instead 2016/12/15 19:11:14 Drive-by: 1) Place this string in components/auto
anthonyvd 2016/12/15 19:55:05 Will do!
48 content_view);
49 }
50
51 void OrderSummaryViewController::ButtonPressed(
52 views::Button* sender, const ui::Event& event) {
53 DCHECK_EQ(kBackButtonTag, sender->tag());
please use gerrit instead 2016/12/15 19:11:14 #include "base/logging.h"
anthonyvd 2016/12/15 19:55:05 Done.
54
55 dialog()->GoBack();
56 }
57
58 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698