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/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 // static |
| 25 std::unique_ptr<views::View> OrderSummaryViewController::CreateView( |
| 26 OrderSummaryViewController* controller) { |
| 27 views::View* content_view = new views::View; |
| 28 |
| 29 views::GridLayout* layout = new views::GridLayout(content_view); |
| 30 content_view->SetLayoutManager(layout); |
| 31 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 32 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, |
| 33 0, views::GridLayout::USE_PREF, 0, 0); |
| 34 |
| 35 layout->StartRow(0, 0); |
| 36 views::LabelButton* back_button = |
| 37 views::MdTextButton::CreateSecondaryUiBlueButton( |
| 38 controller, base::ASCIIToUTF16("Back")); |
| 39 back_button->set_tag(kBackButtonTag); |
| 40 layout->AddView(back_button); |
| 41 |
| 42 return payments::CreatePaymentView( |
| 43 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_TITLE), |
| 44 content_view); |
| 45 } |
| 46 |
| 47 OrderSummaryViewController::OrderSummaryViewController( |
| 48 PaymentRequestImpl* impl, PaymentRequestDialog* dialog) |
| 49 : PaymentRequestSheetController(impl, dialog) {} |
| 50 |
| 51 void OrderSummaryViewController::ButtonPressed( |
| 52 views::Button* sender, const ui::Event& event) { |
| 53 DCHECK_EQ(kBackButtonTag, sender->tag()); |
| 54 |
| 55 dialog()->GoBack(); |
| 56 } |
| 57 |
| 58 } // namespace payments |
OLD | NEW |