OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "chrome/browser/ui/views/payments/payment_request_item_list.h" | |
13 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | |
14 | |
15 namespace autofill { | |
16 class AutofillProfile; | |
17 } | |
18 | |
please use gerrit instead
2017/03/10 20:23:12
namespace views {
class Button;
}
tmartino
2017/03/10 23:46:23
Done. Also added View
| |
19 namespace payments { | |
20 | |
21 class PaymentRequest; | |
22 class PaymentRequestDialogView; | |
23 | |
24 // This base class encapsulates common view logic for contexts which display | |
25 // a list of profiles and allow exactly one of them to be selected. | |
26 class ProfileListViewController : public PaymentRequestSheetController { | |
27 public: | |
28 ~ProfileListViewController() override; | |
29 | |
30 // Creates a controller which lists and allows selection of profiles | |
31 // for shipping address. | |
32 static std::unique_ptr<ProfileListViewController> | |
33 GetShippingProfileViewController(PaymentRequest* request, | |
34 PaymentRequestDialogView* dialog); | |
35 | |
36 // Creates a controller which lists and allows selection of profiles | |
37 // for contact info. | |
38 static std::unique_ptr<ProfileListViewController> | |
39 GetContactProfileViewController(PaymentRequest* request, | |
40 PaymentRequestDialogView* dialog); | |
41 | |
42 // PaymentRequestSheetController: | |
43 std::unique_ptr<views::View> CreateView() override; | |
44 | |
45 // Returns a representation of the given profile appropriate for display | |
46 // in this context. | |
47 virtual std::unique_ptr<views::View> GetLabel( | |
48 autofill::AutofillProfile* profile) = 0; | |
49 | |
50 protected: | |
51 // Does not take ownership of the arguments, which should outlive this object. | |
52 ProfileListViewController(PaymentRequest* request, | |
53 PaymentRequestDialogView* dialog); | |
54 | |
55 // Returns the profiles cached by |request| which are appropriate for display | |
56 // in this context. | |
57 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; | |
58 | |
59 // Returns the string displayed at the top of the view. | |
60 virtual base::string16 GetHeaderString() = 0; | |
61 | |
62 PaymentRequest* request_; | |
please use gerrit instead
2017/03/10 20:23:12
Add a comment: "// Not owned. Never null. Outlives
tmartino
2017/03/10 23:46:23
Done
| |
63 | |
64 private: | |
65 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); | |
66 PaymentRequestItemList list_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); | |
69 }; | |
70 | |
71 } // namespace payments | |
72 | |
73 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | |
OLD | NEW |