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_PROFILE_LIST_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; | 60 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; |
61 | 61 |
62 // Shows an editor for modifying |profile|, or for creating a new profile | 62 // Shows an editor for modifying |profile|, or for creating a new profile |
63 // if |profile| is null. | 63 // if |profile| is null. |
64 virtual void ShowEditor(autofill::AutofillProfile* profile) = 0; | 64 virtual void ShowEditor(autofill::AutofillProfile* profile) = 0; |
65 | 65 |
66 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; | 66 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; |
67 | 67 |
68 virtual bool IsValidProfile(const autofill::AutofillProfile& profile) = 0; | 68 virtual bool IsValidProfile(const autofill::AutofillProfile& profile) = 0; |
69 | 69 |
| 70 // Whether |profile| should be displayed in an enabled state and selectable. |
| 71 bool IsEnabled(autofill::AutofillProfile* profile); |
| 72 |
70 protected: | 73 protected: |
71 // Does not take ownership of the arguments, which should outlive this object. | 74 // Does not take ownership of the arguments, which should outlive this object. |
72 ProfileListViewController(PaymentRequestSpec* spec, | 75 ProfileListViewController(PaymentRequestSpec* spec, |
73 PaymentRequestState* state, | 76 PaymentRequestState* state, |
74 PaymentRequestDialogView* dialog); | 77 PaymentRequestDialogView* dialog); |
75 | 78 |
76 // Returns the profiles cached by |request| which are appropriate for display | 79 // Returns the profiles cached by |request| which are appropriate for display |
77 // in this context. | 80 // in this context. |
78 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; | 81 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; |
79 | 82 |
80 virtual DialogViewID GetDialogViewId() = 0; | 83 virtual DialogViewID GetDialogViewId() = 0; |
81 | 84 |
| 85 // Subclasses may choose to provide a header view to go on top of the item |
| 86 // list view. |
| 87 virtual std::unique_ptr<views::View> CreateHeaderView(); |
| 88 |
82 void PopulateList(); | 89 void PopulateList(); |
83 | 90 |
84 // PaymentRequestSheetController: | 91 // PaymentRequestSheetController: |
85 void FillContentView(views::View* content_view) override; | 92 void FillContentView(views::View* content_view) override; |
86 | 93 |
87 // Settings and events related to the secondary button in the footer area. | 94 // Settings and events related to the secondary button in the footer area. |
88 virtual int GetSecondaryButtonTextId() = 0; | 95 virtual int GetSecondaryButtonTextId() = 0; |
89 virtual int GetSecondaryButtonTag() = 0; | 96 virtual int GetSecondaryButtonTag() = 0; |
90 virtual int GetSecondaryButtonViewId() = 0; | 97 virtual int GetSecondaryButtonViewId() = 0; |
91 | 98 |
92 private: | 99 private: |
93 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); | 100 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); |
94 PaymentRequestItemList list_; | 101 PaymentRequestItemList list_; |
95 | 102 |
96 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); | 103 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
97 }; | 104 }; |
98 | 105 |
99 } // namespace payments | 106 } // namespace payments |
100 | 107 |
101 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | 108 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
OLD | NEW |