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

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: monday rebase 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 <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
19 namespace views {
20 class Button;
21 class View;
22 }
23
24 namespace payments {
25
26 class PaymentRequest;
27 class PaymentRequestDialogView;
28
29 // This base class encapsulates common view logic for contexts which display
30 // a list of profiles and allow exactly one of them to be selected.
31 class ProfileListViewController : public PaymentRequestSheetController {
32 public:
33 ~ProfileListViewController() override;
34
35 // Creates a controller which lists and allows selection of profiles
36 // for shipping address.
37 static std::unique_ptr<ProfileListViewController>
38 GetShippingProfileViewController(PaymentRequest* request,
39 PaymentRequestDialogView* dialog);
40
41 // Creates a controller which lists and allows selection of profiles
42 // for contact info.
43 static std::unique_ptr<ProfileListViewController>
44 GetContactProfileViewController(PaymentRequest* request,
45 PaymentRequestDialogView* dialog);
46
47 // PaymentRequestSheetController:
48 std::unique_ptr<views::View> CreateView() override;
49
50 // Returns a representation of the given profile appropriate for display
51 // in this context.
52 virtual std::unique_ptr<views::View> GetLabel(
53 autofill::AutofillProfile* profile) = 0;
54
55 protected:
56 // Does not take ownership of the arguments, which should outlive this object.
57 ProfileListViewController(PaymentRequest* request,
58 PaymentRequestDialogView* dialog);
59
60 // Returns the profiles cached by |request| which are appropriate for display
61 // in this context.
62 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0;
63
64 // Returns the string displayed at the top of the view.
65 virtual base::string16 GetHeaderString() = 0;
66
67 // Not owned. Never null. Outlives this object.
68 PaymentRequest* request_;
69
70 private:
71 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile);
72 PaymentRequestItemList list_;
73
74 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController);
75 };
76
77 } // namespace payments
78
79 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698