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

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

Issue 2748133004: [Payments] View controllers no longer have access to PaymentRequest (Closed)
Patch Set: Initial 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
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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/ui/views/payments/payment_request_item_list.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" 13 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
14 14
15 namespace autofill { 15 namespace autofill {
16 class AutofillProfile; 16 class AutofillProfile;
17 } 17 }
18 18
19 namespace views { 19 namespace views {
20 class Button; 20 class Button;
21 class View; 21 class View;
22 } 22 }
23 23
24 namespace payments { 24 namespace payments {
25 25
26 class PaymentRequest; 26 class PaymentRequestSpec;
27 class PaymentRequestState;
27 class PaymentRequestDialogView; 28 class PaymentRequestDialogView;
28 29
29 // This base class encapsulates common view logic for contexts which display 30 // 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 // a list of profiles and allow exactly one of them to be selected.
31 class ProfileListViewController : public PaymentRequestSheetController { 32 class ProfileListViewController : public PaymentRequestSheetController {
32 public: 33 public:
33 ~ProfileListViewController() override; 34 ~ProfileListViewController() override;
34 35
35 // Creates a controller which lists and allows selection of profiles 36 // Creates a controller which lists and allows selection of profiles
36 // for shipping address. 37 // for shipping address.
37 static std::unique_ptr<ProfileListViewController> 38 static std::unique_ptr<ProfileListViewController>
38 GetShippingProfileViewController(PaymentRequest* request, 39 GetShippingProfileViewController(PaymentRequestSpec* spec,
40 PaymentRequestState* state,
39 PaymentRequestDialogView* dialog); 41 PaymentRequestDialogView* dialog);
40 42
41 // Creates a controller which lists and allows selection of profiles 43 // Creates a controller which lists and allows selection of profiles
42 // for contact info. 44 // for contact info.
43 static std::unique_ptr<ProfileListViewController> 45 static std::unique_ptr<ProfileListViewController>
44 GetContactProfileViewController(PaymentRequest* request, 46 GetContactProfileViewController(PaymentRequestSpec* spec,
47 PaymentRequestState* state,
45 PaymentRequestDialogView* dialog); 48 PaymentRequestDialogView* dialog);
46 49
47 // PaymentRequestSheetController: 50 // PaymentRequestSheetController:
48 std::unique_ptr<views::View> CreateView() override; 51 std::unique_ptr<views::View> CreateView() override;
49 52
50 // Returns a representation of the given profile appropriate for display 53 // Returns a representation of the given profile appropriate for display
51 // in this context. 54 // in this context.
52 virtual std::unique_ptr<views::View> GetLabel( 55 virtual std::unique_ptr<views::View> GetLabel(
53 autofill::AutofillProfile* profile) = 0; 56 autofill::AutofillProfile* profile) = 0;
54 57
55 protected: 58 protected:
56 // Does not take ownership of the arguments, which should outlive this object. 59 // Does not take ownership of the arguments, which should outlive this object.
57 ProfileListViewController(PaymentRequest* request, 60 ProfileListViewController(PaymentRequestSpec* spec,
61 PaymentRequestState* state,
58 PaymentRequestDialogView* dialog); 62 PaymentRequestDialogView* dialog);
59 63
60 // Returns the profiles cached by |request| which are appropriate for display 64 // Returns the profiles cached by |request| which are appropriate for display
61 // in this context. 65 // in this context.
62 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; 66 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0;
63 67
64 // Returns the string displayed at the top of the view. 68 // Returns the string displayed at the top of the view.
65 virtual base::string16 GetHeaderString() = 0; 69 virtual base::string16 GetHeaderString() = 0;
66 70
67 private: 71 private:
68 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); 72 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile);
69 PaymentRequestItemList list_; 73 PaymentRequestItemList list_;
70 74
71 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); 75 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController);
72 }; 76 };
73 77
74 } // namespace payments 78 } // namespace payments
75 79
76 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ 80 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698