| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class ImageView; |
| 14 class View; | 15 class View; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace payments { | 18 namespace payments { |
| 18 | 19 |
| 19 class PaymentRequest; | 20 class PaymentRequest; |
| 20 | 21 |
| 21 // A control representing a list of selectable items in the PaymentRequest | 22 // A control representing a list of selectable items in the PaymentRequest |
| 22 // dialog. These lists enforce that only one of their elements be selectable at | 23 // dialog. These lists enforce that only one of their elements be selectable at |
| 23 // a time and that "incomplete" items (for example, a credit card with no known | 24 // a time and that "incomplete" items (for example, a credit card with no known |
| (...skipping 29 matching lines...) Expand all Loading... |
| 53 protected: | 54 protected: |
| 54 // Creates and returns the view associated with this list item. | 55 // Creates and returns the view associated with this list item. |
| 55 virtual std::unique_ptr<views::View> CreateItemView() = 0; | 56 virtual std::unique_ptr<views::View> CreateItemView() = 0; |
| 56 | 57 |
| 57 // Called when the selected state of this item changes. Subclasses may | 58 // Called when the selected state of this item changes. Subclasses may |
| 58 // assume that they are the only selected item in |list| when this is | 59 // assume that they are the only selected item in |list| when this is |
| 59 // called. This could be called before CreateItemView so subclasses should | 60 // called. This could be called before CreateItemView so subclasses should |
| 60 // be aware that their views might not exist yet. | 61 // be aware that their views might not exist yet. |
| 61 virtual void SelectedStateChanged() = 0; | 62 virtual void SelectedStateChanged() = 0; |
| 62 | 63 |
| 64 // Creates an image of a large checkmark, used to indicate that an option is |
| 65 // selected. |
| 66 std::unique_ptr<views::ImageView> CreateCheckmark(bool selected); |
| 67 |
| 63 private: | 68 private: |
| 64 std::unique_ptr<views::View> item_view_; | 69 std::unique_ptr<views::View> item_view_; |
| 65 PaymentRequest* request_; | 70 PaymentRequest* request_; |
| 66 PaymentRequestItemList* list_; | 71 PaymentRequestItemList* list_; |
| 67 bool selected_; | 72 bool selected_; |
| 68 | 73 |
| 69 DISALLOW_COPY_AND_ASSIGN(Item); | 74 DISALLOW_COPY_AND_ASSIGN(Item); |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 PaymentRequestItemList(); | 77 PaymentRequestItemList(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 | 96 |
| 92 std::vector<std::unique_ptr<Item>> items_; | 97 std::vector<std::unique_ptr<Item>> items_; |
| 93 Item* selected_item_; | 98 Item* selected_item_; |
| 94 | 99 |
| 95 DISALLOW_COPY_AND_ASSIGN(PaymentRequestItemList); | 100 DISALLOW_COPY_AND_ASSIGN(PaymentRequestItemList); |
| 96 }; | 101 }; |
| 97 | 102 |
| 98 } // namespace payments | 103 } // namespace payments |
| 99 | 104 |
| 100 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ | 105 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ITEM_LIST_H_ |
| OLD | NEW |