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/payment_sheet_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/label_button.h" | |
| 13 #include "ui/views/controls/button/md_text_button.h" | |
| 14 #include "ui/views/layout/grid_layout.h" | |
| 15 #include "ui/views/view.h" | |
| 16 | |
| 17 namespace { | |
| 18 | |
| 19 // The tag for the button that navigates to the Order Summary sheet. | |
| 20 constexpr int kOrderSummaryTag = 0; | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 namespace payments { | |
| 25 | |
| 26 PaymentSheetViewController::PaymentSheetViewController( | |
| 27 PaymentRequestImpl* impl, PaymentRequestDialog* dialog) | |
| 28 : PaymentRequestSheetController(impl, dialog) {} | |
| 29 | |
| 30 PaymentSheetViewController::~PaymentSheetViewController() {} | |
| 31 | |
| 32 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() { | |
| 33 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); | |
|
please use gerrit instead
2016/12/15 20:29:33
<memory>
ptr_util.h
anthonyvd
2016/12/15 20:58:09
Done.
| |
| 34 | |
| 35 views::GridLayout* layout = new views::GridLayout(content_view.get()); | |
| 36 content_view->SetLayoutManager(layout); | |
| 37 views::ColumnSet* columns = layout->AddColumnSet(0); | |
| 38 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, | |
| 39 0, views::GridLayout::USE_PREF, 0, 0); | |
| 40 | |
| 41 layout->StartRow(0, 0); | |
| 42 views::LabelButton* order_summary_button = | |
| 43 views::MdTextButton::CreateSecondaryUiBlueButton( | |
| 44 this, base::ASCIIToUTF16("Order Summary")); | |
| 45 order_summary_button->set_tag(kOrderSummaryTag); | |
| 46 layout->AddView(order_summary_button); | |
| 47 | |
| 48 return payments::CreatePaymentView( | |
| 49 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), | |
| 50 std::move(content_view)); | |
|
please use gerrit instead
2016/12/15 20:29:33
<utility>
anthonyvd
2016/12/15 20:58:09
Done.
| |
| 51 } | |
| 52 | |
| 53 void PaymentSheetViewController::ButtonPressed( | |
| 54 views::Button* sender, const ui::Event& event) { | |
| 55 DCHECK_EQ(kOrderSummaryTag, sender->tag()); | |
| 56 | |
| 57 dialog()->ShowOrderSummary(); | |
| 58 } | |
| 59 | |
| 60 } // namespace payments | |
| OLD | NEW |