| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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_method_view_controller.h" |
| 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
| 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.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 "components/payments/payment_request.h" |
| 15 #include "components/strings/grit/components_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" |
| 17 |
| 18 namespace payments { |
| 19 |
| 20 PaymentMethodViewController::PaymentMethodViewController( |
| 21 PaymentRequest* request, PaymentRequestDialog* dialog) |
| 22 : PaymentRequestSheetController(request, dialog) {} |
| 23 |
| 24 PaymentMethodViewController::~PaymentMethodViewController() {} |
| 25 |
| 26 std::unique_ptr<views::View> PaymentMethodViewController::CreateView() { |
| 27 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); |
| 28 |
| 29 // TODO(anthonyvd): populate this view. |
| 30 |
| 31 return CreatePaymentView(CreateSheetHeaderView( |
| 32 true, |
| 33 l10n_util::GetStringUTF16( |
| 34 IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME), |
| 35 this), |
| 36 std::move(content_view)); |
| 37 } |
| 38 |
| 39 void PaymentMethodViewController::ButtonPressed( |
| 40 views::Button* sender, const ui::Event& event) { |
| 41 switch (sender->tag()) { |
| 42 case static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG): |
| 43 dialog()->CloseDialog(); |
| 44 break; |
| 45 case static_cast<int>(PaymentRequestCommonTags::BACK_BUTTON_TAG): |
| 46 dialog()->GoBack(); |
| 47 break; |
| 48 default: |
| 49 NOTREACHED(); |
| 50 } |
| 51 } |
| 52 |
| 53 } // namespace payments |
| OLD | NEW |