Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/browser/ui/views/payments/profile_list_view_controller.h

Issue 2735803003: [WebPayments] Extracting common code from Shipping + Contact Info views. (Closed)
Patch Set: removing extraneous todo Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "base/macros.h"
9 #include "chrome/browser/ui/views/payments/payment_request_item_list.h"
10 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
11
12 namespace autofill {
13 class AutofillProfile;
14 }
15
16 namespace payments {
17
18 class PaymentRequest;
19 class PaymentRequestDialogView;
20
21 // This base class encapsulates common view logic for contexts which display
22 // a list of profiles and allow exactly one of them to be selected.
23 class ProfileListViewController : public PaymentRequestSheetController {
24 public:
25 ~ProfileListViewController() override;
26
27 // Creates a controller which lists and allows selection of profiles
28 // for shipping address.
29 static std::unique_ptr<ProfileListViewController>
30 GetShippingProfileViewController(PaymentRequest* request,
31 PaymentRequestDialogView* dialog);
32
33 // Creates a controller which lists and allows selection of profiles
34 // for contact info.
35 static std::unique_ptr<ProfileListViewController>
36 GetContactProfileViewController(PaymentRequest* request,
37 PaymentRequestDialogView* dialog);
38
39 // PaymentRequestSheetController:
40 std::unique_ptr<views::View> CreateView() override;
41
42 // Returns a representation of the given profile appropriate for display
43 // in this context.
44 virtual std::unique_ptr<views::View> GetLabel(
45 autofill::AutofillProfile* profile) = 0;
46
47 protected:
48 // Does not take ownership of the arguments, which should outlive this object.
49 ProfileListViewController(PaymentRequest* request,
50 PaymentRequestDialogView* dialog);
51
52 // Returns the profiles cached by |request| which are appropriate for display
53 // in this context.
54 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0;
anthonyvd 2017/03/07 15:13:14 nit: include <vector>
tmartino 2017/03/10 15:53:48 Done
55
56 // Returns the string displayed at the top of the view.
57 virtual base::string16 GetHeaderString() = 0;
58
59 private:
60 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile);
anthonyvd 2017/03/07 15:13:14 nit: include <memory>
tmartino 2017/03/10 15:53:48 Done
61 PaymentRequestItemList list_;
62
63 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController);
64 };
65
66 } // namespace payments
67
68 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698