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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // +---------------------------+ | 85 // +---------------------------+ |
86 virtual std::unique_ptr<views::View> CreateExtraFooterView(); | 86 virtual std::unique_ptr<views::View> CreateExtraFooterView(); |
87 | 87 |
88 // views::ButtonListener: | 88 // views::ButtonListener: |
89 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 89 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
90 | 90 |
91 // Creates the row of button containing the Pay, cancel, and extra buttons. | 91 // Creates the row of button containing the Pay, cancel, and extra buttons. |
92 // |controller| is installed as the listener for button events. | 92 // |controller| is installed as the listener for button events. |
93 std::unique_ptr<views::View> CreateFooterView(); | 93 std::unique_ptr<views::View> CreateFooterView(); |
94 | 94 |
95 // Returns the view that should be initially focused on this sheet. Typically, | |
96 // this returns the primary button if it's enabled or the secondary button | |
97 // otherwise. Subclasses may return a different view if they need focus to | |
98 // start off on a different view (a textfield for example). This will only be | |
99 // called after the view has been completely created through calls to | |
100 // CreatePaymentView and related functions. | |
101 virtual views::View* GetFirstFocusedView(); | |
102 | |
95 private: | 103 private: |
96 // Creates a view to be displayed in the PaymentRequestDialog. | 104 // Creates a view to be displayed in the PaymentRequestDialog. |
97 // |header_view| is the view displayed on top of the dialog, containing title, | 105 // |header_view| is the view displayed on top of the dialog, containing title, |
98 // (optional) back button, and close buttons. | 106 // (optional) back button, and close buttons. |
99 // |content_view| is displayed between |header_view| and the pay/cancel | 107 // |content_view| is displayed between |header_view| and the pay/cancel |
100 // buttons. Also adds the footer, returned by CreateFooterView(), which is | 108 // buttons. Also adds the footer, returned by CreateFooterView(), which is |
101 // clamped to the bottom of the containing view. The returned view takes | 109 // clamped to the bottom of the containing view. The returned view takes |
102 // ownership of |header_view|, |content_view|, and the footer. | 110 // ownership of |header_view|, |content_view|, and the footer. |
103 // +---------------------------+ | 111 // +---------------------------+ |
104 // | HEADER VIEW | | 112 // | HEADER VIEW | |
105 // +---------------------------+ | 113 // +---------------------------+ |
106 // | CONTENT | | 114 // | CONTENT | |
107 // | VIEW | | 115 // | VIEW | |
108 // +---------------------------+ | 116 // +---------------------------+ |
109 // | EXTRA VIEW | PAY | CANCEL | <-- footer | 117 // | EXTRA VIEW | PAY | CANCEL | <-- footer |
110 // +---------------------------+ | 118 // +---------------------------+ |
111 std::unique_ptr<views::View> CreatePaymentView(); | 119 std::unique_ptr<views::View> CreatePaymentView(); |
112 | 120 |
113 // All these are not owned. Will outlive this. | 121 // All these are not owned. Will outlive this. |
114 PaymentRequestSpec* spec_; | 122 PaymentRequestSpec* spec_; |
115 PaymentRequestState* state_; | 123 PaymentRequestState* state_; |
116 PaymentRequestDialogView* dialog_; | 124 PaymentRequestDialogView* dialog_; |
117 | 125 |
118 // This view is owned by its encompassing ScrollView. | 126 // This view is owned by its encompassing ScrollView. |
119 views::View* pane_; | 127 views::View* pane_; |
120 views::View* content_view_; | 128 views::View* content_view_; |
121 | 129 |
122 // Hold on to the ScrollView because it must be explicitly laid out in some | 130 // Hold on to the ScrollView because it must be explicitly laid out in some |
Mathieu
2017/05/02 13:16:10
update/split comment to reflect more variables
anthonyvd
2017/05/02 13:43:32
Done.
| |
123 // cases. | 131 // cases. |
124 std::unique_ptr<views::ScrollView> scroll_; | 132 std::unique_ptr<views::ScrollView> scroll_; |
133 std::unique_ptr<views::Button> primary_button_; | |
134 std::unique_ptr<views::Button> secondary_button_; | |
125 | 135 |
126 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | 136 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
127 }; | 137 }; |
128 | 138 |
129 } // namespace payments | 139 } // namespace payments |
130 | 140 |
131 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 141 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
OLD | NEW |