OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_ITEM_LIST_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 std::unique_ptr<views::ImageView> CreateCheckmark(bool selected); | 69 std::unique_ptr<views::ImageView> CreateCheckmark(bool selected); |
70 | 70 |
71 // Creates the view that represents this item's content. Typically this will | 71 // Creates the view that represents this item's content. Typically this will |
72 // be a label describing the payment method, shipping adress, etc. | 72 // be a label describing the payment method, shipping adress, etc. |
73 virtual std::unique_ptr<views::View> CreateContentView() = 0; | 73 virtual std::unique_ptr<views::View> CreateContentView() = 0; |
74 | 74 |
75 // Creates the view that should be displayed after the checkmark in the | 75 // Creates the view that should be displayed after the checkmark in the |
76 // item's view, such as the credit card icon. | 76 // item's view, such as the credit card icon. |
77 virtual std::unique_ptr<views::View> CreateExtraView(); | 77 virtual std::unique_ptr<views::View> CreateExtraView(); |
78 | 78 |
| 79 // Whether the item should be enabled (if disabled, the user will not be |
| 80 // able to click on the item). |
| 81 virtual bool IsEnabled() = 0; |
| 82 |
79 // Returns whether this item is complete/valid and can be selected by the | 83 // Returns whether this item is complete/valid and can be selected by the |
80 // user. If this returns false when the user attempts to select this item, | 84 // user. If this returns false when the user attempts to select this item, |
81 // PerformSelectionFallback will be called instead. | 85 // PerformSelectionFallback will be called instead. |
82 virtual bool CanBeSelected() const = 0; | 86 virtual bool CanBeSelected() = 0; |
83 | 87 |
84 // Performs the action that replaces selection when CanBeSelected returns | 88 // Performs the action that replaces selection when CanBeSelected returns |
85 // false. This will usually be to display an editor. | 89 // false. This will usually be to display an editor. |
86 virtual void PerformSelectionFallback() = 0; | 90 virtual void PerformSelectionFallback() = 0; |
87 | 91 |
88 private: | 92 private: |
89 // Creates and returns the view associated with this list item. | 93 // Creates and returns the view associated with this list item. |
90 std::unique_ptr<views::View> CreateItemView(); | 94 std::unique_ptr<views::View> CreateItemView(); |
91 | 95 |
92 // views::ButtonListener: | 96 // views::ButtonListener: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 128 |
125 std::vector<std::unique_ptr<Item>> items_; | 129 std::vector<std::unique_ptr<Item>> items_; |
126 Item* selected_item_; | 130 Item* selected_item_; |
127 | 131 |
128 DISALLOW_COPY_AND_ASSIGN(PaymentRequestItemList); | 132 DISALLOW_COPY_AND_ASSIGN(PaymentRequestItemList); |
129 }; | 133 }; |
130 | 134 |
131 } // namespace payments | 135 } // namespace payments |
132 | 136 |
133 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ | 137 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ |
OLD | NEW |