| 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/image_button.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class Button; | 14 class Button; |
| 15 class View; | 15 class View; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace payments { | 18 namespace payments { |
| 19 | 19 |
| 20 class PaymentRequestDialogView; | 20 class PaymentRequestDialogView; |
| 21 class PaymentRequest; | 21 class PaymentRequest; |
| 22 | 22 |
| 23 // 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 |
| 24 // views shown in the PaymentRequestDialog. | 24 // views shown in the PaymentRequestDialog. |
| 25 class PaymentRequestSheetController : public views::VectorIconButtonDelegate { | 25 class PaymentRequestSheetController : public views::ImageButtonDelegate { |
| 26 public: | 26 public: |
| 27 // 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 |
| 28 // that should be valid throughout this object's lifetime. | 28 // that should be valid throughout this object's lifetime. |
| 29 // |request| is also not owned by this and is guaranteed to outlive dialog. | 29 // |request| is also not owned by this and is guaranteed to outlive dialog. |
| 30 // Neither |request| or |dialog| should be null. | 30 // Neither |request| or |dialog| should be null. |
| 31 PaymentRequestSheetController(PaymentRequest* request, | 31 PaymentRequestSheetController(PaymentRequest* request, |
| 32 PaymentRequestDialogView* dialog); | 32 PaymentRequestDialogView* dialog); |
| 33 ~PaymentRequestSheetController() override {} | 33 ~PaymentRequestSheetController() override {} |
| 34 | 34 |
| 35 virtual std::unique_ptr<views::View> CreateView() = 0; | 35 virtual std::unique_ptr<views::View> CreateView() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 // 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 |
| 58 // 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 |
| 59 // 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 |
| 60 // 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 |
| 61 // 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. |
| 62 // +---------------------------+ | 62 // +---------------------------+ |
| 63 // | EXTRA VIEW | PAY | CANCEL | | 63 // | EXTRA VIEW | PAY | CANCEL | |
| 64 // +---------------------------+ | 64 // +---------------------------+ |
| 65 virtual std::unique_ptr<views::View> CreateExtraFooterView(); | 65 virtual std::unique_ptr<views::View> CreateExtraFooterView(); |
| 66 | 66 |
| 67 // views::VectorIconButtonDelegate: | 67 // views::ImageButtonDelegate: |
| 68 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 68 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 69 | 69 |
| 70 // Creates a view to be displayed in the PaymentRequestDialog. | 70 // Creates a view to be displayed in the PaymentRequestDialog. |
| 71 // |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, |
| 72 // (optional) back button, and close buttons. | 72 // (optional) back button, and close buttons. |
| 73 // |content_view| is displayed between |header_view| and the pay/cancel | 73 // |content_view| is displayed between |header_view| and the pay/cancel |
| 74 // buttons. Also adds the footer, returned by CreateFooterView(), which is | 74 // buttons. Also adds the footer, returned by CreateFooterView(), which is |
| 75 // 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 |
| 76 // ownership of |header_view|, |content_view|, and the footer. | 76 // ownership of |header_view|, |content_view|, and the footer. |
| 77 // +---------------------------+ | 77 // +---------------------------+ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 PaymentRequest* request_; | 95 PaymentRequest* request_; |
| 96 // Not owned. Will outlive this. | 96 // Not owned. Will outlive this. |
| 97 PaymentRequestDialogView* dialog_; | 97 PaymentRequestDialogView* dialog_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | 99 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace payments | 102 } // namespace payments |
| 103 | 103 |
| 104 #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 |