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 | |
(...skipping 11 matching lines...) Expand all Loading... |
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 |
123 // cases. | 131 // cases. |
124 std::unique_ptr<views::ScrollView> scroll_; | 132 std::unique_ptr<views::ScrollView> scroll_; |
125 | 133 |
| 134 // Hold on to the primary and secondary buttons to use them as initial focus |
| 135 // targets when subclasses don't want to focus anything else. |
| 136 std::unique_ptr<views::Button> primary_button_; |
| 137 std::unique_ptr<views::Button> secondary_button_; |
| 138 |
126 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | 139 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
127 }; | 140 }; |
128 | 141 |
129 } // namespace payments | 142 } // namespace payments |
130 | 143 |
131 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | 144 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
OLD | NEW |