Chromium Code Reviews| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // Caller should not take ownership of the result. | 45 // Caller should not take ownership of the result. |
| 46 PaymentRequestDialogView* dialog() { return dialog_; } | 46 PaymentRequestDialogView* dialog() { return dialog_; } |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 // Creates and returns the primary action button for this sheet. It's | 49 // Creates and returns the primary action button for this sheet. It's |
| 50 // typically a blue button with the "Pay" or "Done" labels. Subclasses may | 50 // typically a blue button with the "Pay" or "Done" labels. Subclasses may |
| 51 // return an empty std::unique_ptr (nullptr) to indicate that no primary | 51 // return an empty std::unique_ptr (nullptr) to indicate that no primary |
| 52 // button should be displayed. The caller takes ownership of the button but | 52 // button should be displayed. The caller takes ownership of the button but |
| 53 // the view is guaranteed to be outlived by the controller so subclasses may | 53 // the view is guaranteed to be outlived by the controller so subclasses may |
| 54 // retain a raw pointer to the returned button (for example to control its | 54 // retain a raw pointer to the returned button (for example to control its |
| 55 // enabled state). | 55 // enabled state). See comment on CreatePaymentView for an illustration of the |
|
please use gerrit instead
2017/02/22 20:26:28
To ease the job of readers of code, it's a good id
anthonyvd
2017/02/22 20:55:06
Done.
| |
| 56 // layout. | |
| 56 virtual std::unique_ptr<views::Button> CreatePrimaryButton(); | 57 virtual std::unique_ptr<views::Button> CreatePrimaryButton(); |
| 57 | 58 |
| 59 // Creates and returns the view to be displayed next to the "Pay" and "Cancel" | |
| 60 // buttons. May return an empty std::unique_ptr (nullptr) to indicate that no | |
| 61 // extra view is to be displayed.The caller takes ownership of the view but | |
| 62 // the view is guaranteed to be outlived by the controller so subclasses may | |
| 63 // retain a raw pointer to the returned view (for example to control its | |
| 64 // enabled state). See comment on CreatePaymentView for an illustration of the | |
| 65 // layout. | |
|
please use gerrit instead
2017/02/22 20:26:28
In the spirit of making this method understable as
anthonyvd
2017/02/22 20:55:06
Done.
| |
| 66 virtual std::unique_ptr<views::View> CreateExtraView(); | |
| 67 | |
| 58 // views::VectorIconButtonDelegate: | 68 // views::VectorIconButtonDelegate: |
| 59 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 69 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 60 | 70 |
| 61 // Creates a view to be displayed in the PaymentRequestDialog. | 71 // Creates a view to be displayed in the PaymentRequestDialog. |
| 62 // |header_view| is the view displayed on top of the dialog, containing title, | 72 // |header_view| is the view displayed on top of the dialog, containing title, |
| 63 // (optional) back button, and close buttons. | 73 // (optional) back button, and close buttons. |
| 64 // |content_view| is displayed between |header_view| and the pay/cancel | 74 // |content_view| is displayed between |header_view| and the pay/cancel |
| 65 // buttons. Also adds the footer, returned by CreateFooterView(), which is | 75 // buttons. Also adds the footer, returned by CreateFooterView(), which is |
| 66 // clamped to the bottom of the containing view. The returned view takes | 76 // clamped to the bottom of the containing view. The returned view takes |
| 67 // ownership of |header_view|, |content_view|, and the footer. | 77 // ownership of |header_view|, |content_view|, and the footer. |
| 68 // +---------------------------+ | 78 // +---------------------------+ |
| 69 // | HEADER VIEW | | 79 // | HEADER VIEW | |
| 70 // +---------------------------+ | 80 // +---------------------------+ |
| 71 // | CONTENT | | 81 // | CONTENT | |
| 72 // | VIEW | | 82 // | VIEW | |
| 73 // +---------------------------+ | 83 // +---------------------------+ |
| 74 // | | CANCEL | PAY | <-- footer | 84 // | EXTRA VIEW | PAY | CANCEL | <-- footer |
| 75 // +---------------------------+ | 85 // +---------------------------+ |
| 76 std::unique_ptr<views::View> CreatePaymentView( | 86 std::unique_ptr<views::View> CreatePaymentView( |
| 77 std::unique_ptr<views::View> header_view, | 87 std::unique_ptr<views::View> header_view, |
| 78 std::unique_ptr<views::View> content_view); | 88 std::unique_ptr<views::View> content_view); |
| 79 | 89 |
| 80 // Creates the row of button containing the Pay, cancel, and extra buttons. | 90 // Creates the row of button containing the Pay, cancel, and extra buttons. |
| 81 // |controller| is installed as the listener for button events. | 91 // |controller| is installed as the listener for button events. |
| 82 std::unique_ptr<views::View> CreateFooterView(); | 92 std::unique_ptr<views::View> CreateFooterView(); |
| 83 | 93 |
| 84 private: | 94 private: |
| 85 // Not owned. Will outlive this. | 95 // Not owned. Will outlive this. |
| 86 PaymentRequest* request_; | 96 PaymentRequest* request_; |
| 87 // Not owned. Will outlive this. | 97 // Not owned. Will outlive this. |
| 88 PaymentRequestDialogView* dialog_; | 98 PaymentRequestDialogView* dialog_; |
| 89 | 99 |
| 90 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | 100 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
| 91 }; | 101 }; |
| 92 | 102 |
| 93 } // namespace payments | 103 } // namespace payments |
| 94 | 104 |
| 95 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 105 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
| OLD | NEW |