Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/logging.h" | |
| 8 #include "base/strings/utf_string_conversions.h" | |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog.h" | |
| 10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | |
| 11 #include "chrome/grit/generated_resources.h" | |
| 12 #include "ui/base/l10n/l10n_util.h" | |
| 13 #include "ui/views/controls/button/label_button.h" | |
| 14 #include "ui/views/controls/button/md_text_button.h" | |
| 15 #include "ui/views/layout/grid_layout.h" | |
| 16 #include "ui/views/view.h" | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 // The tag for the button that navigates back to the payment sheet. | |
| 21 constexpr int kBackButtonTag = 0; | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 namespace payments { | |
| 26 | |
| 27 OrderSummaryViewController::OrderSummaryViewController( | |
| 28 PaymentRequestImpl* impl, PaymentRequestDialog* dialog) | |
| 29 : PaymentRequestSheetController(impl, dialog) {} | |
| 30 | |
| 31 OrderSummaryViewController::~OrderSummaryViewController() {} | |
| 32 | |
| 33 std::unique_ptr<views::View> OrderSummaryViewController::CreateView() { | |
| 34 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); | |
|
please use gerrit instead
2016/12/15 20:29:33
#include <memory>
(for std::unique_ptr<>)
#incl
anthonyvd
2016/12/15 20:58:08
Done.
| |
| 35 | |
| 36 views::GridLayout* layout = new views::GridLayout(content_view.get()); | |
| 37 content_view->SetLayoutManager(layout); | |
| 38 views::ColumnSet* columns = layout->AddColumnSet(0); | |
| 39 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, | |
| 40 0, views::GridLayout::USE_PREF, 0, 0); | |
| 41 | |
| 42 layout->StartRow(0, 0); | |
| 43 views::LabelButton* back_button = | |
| 44 views::MdTextButton::CreateSecondaryUiBlueButton( | |
| 45 this, base::ASCIIToUTF16("Back")); | |
| 46 back_button->set_tag(kBackButtonTag); | |
| 47 layout->AddView(back_button); | |
| 48 | |
| 49 return payments::CreatePaymentView( | |
| 50 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE), | |
| 51 std::move(content_view)); | |
|
please use gerrit instead
2016/12/15 20:29:33
#include <utility>
(for std::move())
anthonyvd
2016/12/15 20:58:08
Done.
| |
| 52 } | |
| 53 | |
| 54 void OrderSummaryViewController::ButtonPressed( | |
| 55 views::Button* sender, const ui::Event& event) { | |
| 56 DCHECK_EQ(kBackButtonTag, sender->tag()); | |
| 57 | |
| 58 dialog()->GoBack(); | |
| 59 } | |
| 60 | |
| 61 } // namespace payments | |
| OLD | NEW |