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 29 matching lines...) Expand all Loading... |
40 PaymentRequestState* state, | 40 PaymentRequestState* state, |
41 PaymentRequestDialogView* dialog); | 41 PaymentRequestDialogView* dialog); |
42 | 42 |
43 // Creates a controller which lists and allows selection of profiles | 43 // Creates a controller which lists and allows selection of profiles |
44 // for contact info. | 44 // for contact info. |
45 static std::unique_ptr<ProfileListViewController> | 45 static std::unique_ptr<ProfileListViewController> |
46 GetContactProfileViewController(PaymentRequestSpec* spec, | 46 GetContactProfileViewController(PaymentRequestSpec* spec, |
47 PaymentRequestState* state, | 47 PaymentRequestState* state, |
48 PaymentRequestDialogView* dialog); | 48 PaymentRequestDialogView* dialog); |
49 | 49 |
50 // PaymentRequestSheetController: | |
51 std::unique_ptr<views::View> CreateView() override; | |
52 | |
53 // Returns a representation of the given profile appropriate for display | 50 // Returns a representation of the given profile appropriate for display |
54 // in this context. | 51 // in this context. |
55 virtual std::unique_ptr<views::View> GetLabel( | 52 virtual std::unique_ptr<views::View> GetLabel( |
56 autofill::AutofillProfile* profile) = 0; | 53 autofill::AutofillProfile* profile) = 0; |
57 | 54 |
58 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; | 55 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; |
59 | 56 |
60 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; | 57 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; |
61 | 58 |
62 protected: | 59 protected: |
63 // Does not take ownership of the arguments, which should outlive this object. | 60 // Does not take ownership of the arguments, which should outlive this object. |
64 ProfileListViewController(PaymentRequestSpec* spec, | 61 ProfileListViewController(PaymentRequestSpec* spec, |
65 PaymentRequestState* state, | 62 PaymentRequestState* state, |
66 PaymentRequestDialogView* dialog); | 63 PaymentRequestDialogView* dialog); |
67 | 64 |
68 // Returns the profiles cached by |request| which are appropriate for display | 65 // Returns the profiles cached by |request| which are appropriate for display |
69 // in this context. | 66 // in this context. |
70 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; | 67 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; |
71 | 68 |
72 // Returns the string displayed at the top of the view. | 69 void PopulateList(); |
73 virtual base::string16 GetHeaderString() = 0; | 70 |
| 71 // PaymentRequestSheetController: |
| 72 void FillContentView(views::View* content_view) override; |
74 | 73 |
75 private: | 74 private: |
76 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); | 75 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); |
77 PaymentRequestItemList list_; | 76 PaymentRequestItemList list_; |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); | 78 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
80 }; | 79 }; |
81 | 80 |
82 } // namespace payments | 81 } // namespace payments |
83 | 82 |
84 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | 83 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
OLD | NEW |