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 30 matching lines...) Expand all Loading... |
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: | 50 // PaymentRequestSheetController: |
51 std::unique_ptr<views::View> CreateView() override; | |
52 std::unique_ptr<views::View> CreateExtraFooterView() override; | 51 std::unique_ptr<views::View> CreateExtraFooterView() override; |
53 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 52 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
54 | 53 |
55 // Returns a representation of the given profile appropriate for display | 54 // Returns a representation of the given profile appropriate for display |
56 // in this context. | 55 // in this context. |
57 virtual std::unique_ptr<views::View> GetLabel( | 56 virtual std::unique_ptr<views::View> GetLabel( |
58 autofill::AutofillProfile* profile) = 0; | 57 autofill::AutofillProfile* profile) = 0; |
59 | 58 |
60 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; | 59 virtual void SelectProfile(autofill::AutofillProfile* profile) = 0; |
61 | 60 |
62 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; | 61 virtual autofill::AutofillProfile* GetSelectedProfile() = 0; |
63 | 62 |
64 protected: | 63 protected: |
65 // Does not take ownership of the arguments, which should outlive this object. | 64 // Does not take ownership of the arguments, which should outlive this object. |
66 ProfileListViewController(PaymentRequestSpec* spec, | 65 ProfileListViewController(PaymentRequestSpec* spec, |
67 PaymentRequestState* state, | 66 PaymentRequestState* state, |
68 PaymentRequestDialogView* dialog); | 67 PaymentRequestDialogView* dialog); |
69 | 68 |
70 // Returns the profiles cached by |request| which are appropriate for display | 69 // Returns the profiles cached by |request| which are appropriate for display |
71 // in this context. | 70 // in this context. |
72 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; | 71 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; |
73 | 72 |
74 // Returns the string displayed at the top of the view. | 73 void PopulateList(); |
75 virtual base::string16 GetHeaderString() = 0; | 74 |
| 75 // PaymentRequestSheetController: |
| 76 void FillContentView(views::View* content_view) override; |
76 | 77 |
77 // Settings and events related to the secondary button in the footer area. | 78 // Settings and events related to the secondary button in the footer area. |
78 virtual int GetSecondaryButtonTextId() = 0; | 79 virtual int GetSecondaryButtonTextId() = 0; |
79 virtual int GetSecondaryButtonTag() = 0; | 80 virtual int GetSecondaryButtonTag() = 0; |
80 virtual int GetSecondaryButtonViewId() = 0; | 81 virtual int GetSecondaryButtonViewId() = 0; |
81 virtual void OnSecondaryButtonPressed() = 0; | 82 virtual void OnSecondaryButtonPressed() = 0; |
82 | 83 |
83 private: | 84 private: |
84 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); | 85 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); |
85 PaymentRequestItemList list_; | 86 PaymentRequestItemList list_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); | 88 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
88 }; | 89 }; |
89 | 90 |
90 } // namespace payments | 91 } // namespace payments |
91 | 92 |
92 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | 93 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
OLD | NEW |