Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
| diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.h b/chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
| index 6b0ff5d5d1440d541f7c36ebf72986375fa16616..8a10fdf865ac6ed39ea1913024198a4b3d0331ad 100644 |
| --- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
| +++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
| @@ -7,10 +7,11 @@ |
| #include <memory> |
| -#include "base/logging.h" |
| #include "base/macros.h" |
| +#include "ui/views/controls/button/vector_icon_button_delegate.h" |
| namespace views { |
| +class Button; |
| class View; |
| } |
| @@ -21,19 +22,15 @@ class PaymentRequest; |
| // The base class for objects responsible for the creation and event handling in |
| // views shown in the PaymentRequestDialog. |
| -class PaymentRequestSheetController { |
| +class PaymentRequestSheetController : public views::VectorIconButtonDelegate { |
| public: |
| // Objects of this class are owned by |dialog|, so it's a non-owned pointer |
| // that should be valid throughout this object's lifetime. |
| // |request| is also not owned by this and is guaranteed to outlive dialog. |
| // Neither |request| or |dialog| should be null. |
| PaymentRequestSheetController(PaymentRequest* request, |
| - PaymentRequestDialogView* dialog) |
| - : request_(request), dialog_(dialog) { |
| - DCHECK(request_); |
| - DCHECK(dialog_); |
| - } |
| - virtual ~PaymentRequestSheetController() {} |
| + PaymentRequestDialogView* dialog); |
| + ~PaymentRequestSheetController() override {} |
| virtual std::unique_ptr<views::View> CreateView() = 0; |
| @@ -45,6 +42,26 @@ class PaymentRequestSheetController { |
| // Caller should not take ownership of the result. |
| PaymentRequestDialogView* dialog() { return dialog_; } |
| + // Creates and returns the primary action button for this sheet. It's |
| + // typically a blue button with the "Pay" or "Done" labels. Subclasses may |
| + // return an empty std::unique_ptr to indicate that no primary button should |
| + // be displayed. The caller takes ownership of the button but the view is |
| + // guaranteed to be outlived by the controller so subclasses may retain a raw |
| + // pointer to the returned button (for example to control its enabled state). |
| + virtual std::unique_ptr<views::Button> CreatePrimaryButton(); |
| + |
| + protected: |
| + // views::VectorIconButtonDelegate: |
| + void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| + |
| + std::unique_ptr<views::View> CreatePaymentView( |
|
Mathieu
2017/02/02 21:04:58
Comment to say it will add the footer from below
anthonyvd
2017/02/02 21:33:24
Oops, it was still in the utils file. Good catch,
|
| + std::unique_ptr<views::View> header_view, |
| + std::unique_ptr<views::View> content_view); |
| + |
| + // Creates the row of button containing the Pay, cancel, and extra buttons. |
| + // |controller| is installed as the listener for button events. |
| + std::unique_ptr<views::View> CreateFooterView(); |
| + |
| private: |
| // Not owned. Will outlive this. |
| PaymentRequest* request_; |