| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/views/controls/button/vector_icon_button_delegate.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class Button; | |
| 15 class View; | 14 class View; |
| 16 } | 15 } |
| 17 | 16 |
| 18 namespace payments { | 17 namespace payments { |
| 19 | 18 |
| 20 class PaymentRequestDialogView; | 19 class PaymentRequestDialogView; |
| 21 class PaymentRequestSpec; | 20 class PaymentRequestSpec; |
| 22 class PaymentRequestState; | 21 class PaymentRequestState; |
| 23 | 22 |
| 24 // The base class for objects responsible for the creation and event handling in | 23 // The base class for objects responsible for the creation and event handling in |
| 25 // views shown in the PaymentRequestDialog. | 24 // views shown in the PaymentRequestDialog. |
| 26 class PaymentRequestSheetController : public views::VectorIconButtonDelegate { | 25 class PaymentRequestSheetController : public views::ButtonListener { |
| 27 public: | 26 public: |
| 28 // Objects of this class are owned by |dialog|, so it's a non-owned pointer | 27 // Objects of this class are owned by |dialog|, so it's a non-owned pointer |
| 29 // that should be valid throughout this object's lifetime. | 28 // that should be valid throughout this object's lifetime. |
| 30 // |state| and |spec| are also not owned by this and are guaranteed to outlive | 29 // |state| and |spec| are also not owned by this and are guaranteed to outlive |
| 31 // dialog. Neither |state|, |spec| or |dialog| should be null. | 30 // dialog. Neither |state|, |spec| or |dialog| should be null. |
| 32 PaymentRequestSheetController(PaymentRequestSpec* spec, | 31 PaymentRequestSheetController(PaymentRequestSpec* spec, |
| 33 PaymentRequestState* state, | 32 PaymentRequestState* state, |
| 34 PaymentRequestDialogView* dialog); | 33 PaymentRequestDialogView* dialog); |
| 35 ~PaymentRequestSheetController() override {} | 34 ~PaymentRequestSheetController() override {} |
| 36 | 35 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 // extra view is to be displayed.The caller takes ownership of the view but | 57 // extra view is to be displayed.The caller takes ownership of the view but |
| 59 // the view is guaranteed to be outlived by the controller so subclasses may | 58 // the view is guaranteed to be outlived by the controller so subclasses may |
| 60 // retain a raw pointer to the returned view (for example to control its | 59 // retain a raw pointer to the returned view (for example to control its |
| 61 // enabled state). The horizontal and vertical insets (to the left and bottom | 60 // enabled state). The horizontal and vertical insets (to the left and bottom |
| 62 // borders) is taken care of by the caller, so can be set to 0. | 61 // borders) is taken care of by the caller, so can be set to 0. |
| 63 // +---------------------------+ | 62 // +---------------------------+ |
| 64 // | EXTRA VIEW | PAY | CANCEL | | 63 // | EXTRA VIEW | PAY | CANCEL | |
| 65 // +---------------------------+ | 64 // +---------------------------+ |
| 66 virtual std::unique_ptr<views::View> CreateExtraFooterView(); | 65 virtual std::unique_ptr<views::View> CreateExtraFooterView(); |
| 67 | 66 |
| 68 // views::VectorIconButtonDelegate: | 67 // views::ButtonListener: |
| 69 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 68 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 70 | 69 |
| 71 // Creates a view to be displayed in the PaymentRequestDialog. | 70 // Creates a view to be displayed in the PaymentRequestDialog. |
| 72 // |header_view| is the view displayed on top of the dialog, containing title, | 71 // |header_view| is the view displayed on top of the dialog, containing title, |
| 73 // (optional) back button, and close buttons. | 72 // (optional) back button, and close buttons. |
| 74 // |content_view| is displayed between |header_view| and the pay/cancel | 73 // |content_view| is displayed between |header_view| and the pay/cancel |
| 75 // buttons. Also adds the footer, returned by CreateFooterView(), which is | 74 // buttons. Also adds the footer, returned by CreateFooterView(), which is |
| 76 // clamped to the bottom of the containing view. The returned view takes | 75 // clamped to the bottom of the containing view. The returned view takes |
| 77 // ownership of |header_view|, |content_view|, and the footer. | 76 // ownership of |header_view|, |content_view|, and the footer. |
| 78 // +---------------------------+ | 77 // +---------------------------+ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 96 PaymentRequestSpec* spec_; | 95 PaymentRequestSpec* spec_; |
| 97 PaymentRequestState* state_; | 96 PaymentRequestState* state_; |
| 98 PaymentRequestDialogView* dialog_; | 97 PaymentRequestDialogView* dialog_; |
| 99 | 98 |
| 100 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | 99 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 } // namespace payments | 102 } // namespace payments |
| 104 | 103 |
| 105 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 104 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
| OLD | NEW |