| 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 |
| 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 enum class DialogViewID; |
| 26 class PaymentRequestSpec; | 27 class PaymentRequestSpec; |
| 27 class PaymentRequestState; | 28 class PaymentRequestState; |
| 28 class PaymentRequestDialogView; | 29 class PaymentRequestDialogView; |
| 29 | 30 |
| 30 // This base class encapsulates common view logic for contexts which display | 31 // This base class encapsulates common view logic for contexts which display |
| 31 // a list of profiles and allow exactly one of them to be selected. | 32 // a list of profiles and allow exactly one of them to be selected. |
| 32 class ProfileListViewController : public PaymentRequestSheetController { | 33 class ProfileListViewController : public PaymentRequestSheetController { |
| 33 public: | 34 public: |
| 34 ~ProfileListViewController() override; | 35 ~ProfileListViewController() override; |
| 35 | 36 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 63 protected: | 64 protected: |
| 64 // Does not take ownership of the arguments, which should outlive this object. | 65 // Does not take ownership of the arguments, which should outlive this object. |
| 65 ProfileListViewController(PaymentRequestSpec* spec, | 66 ProfileListViewController(PaymentRequestSpec* spec, |
| 66 PaymentRequestState* state, | 67 PaymentRequestState* state, |
| 67 PaymentRequestDialogView* dialog); | 68 PaymentRequestDialogView* dialog); |
| 68 | 69 |
| 69 // Returns the profiles cached by |request| which are appropriate for display | 70 // Returns the profiles cached by |request| which are appropriate for display |
| 70 // in this context. | 71 // in this context. |
| 71 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; | 72 virtual std::vector<autofill::AutofillProfile*> GetProfiles() = 0; |
| 72 | 73 |
| 74 virtual DialogViewID GetDialogViewId() = 0; |
| 75 |
| 73 void PopulateList(); | 76 void PopulateList(); |
| 74 | 77 |
| 75 // PaymentRequestSheetController: | 78 // PaymentRequestSheetController: |
| 76 void FillContentView(views::View* content_view) override; | 79 void FillContentView(views::View* content_view) override; |
| 77 | 80 |
| 78 // Settings and events related to the secondary button in the footer area. | 81 // Settings and events related to the secondary button in the footer area. |
| 79 virtual int GetSecondaryButtonTextId() = 0; | 82 virtual int GetSecondaryButtonTextId() = 0; |
| 80 virtual int GetSecondaryButtonTag() = 0; | 83 virtual int GetSecondaryButtonTag() = 0; |
| 81 virtual int GetSecondaryButtonViewId() = 0; | 84 virtual int GetSecondaryButtonViewId() = 0; |
| 82 virtual void OnSecondaryButtonPressed() = 0; | 85 virtual void OnSecondaryButtonPressed() = 0; |
| 83 | 86 |
| 84 private: | 87 private: |
| 85 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); | 88 std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); |
| 86 PaymentRequestItemList list_; | 89 PaymentRequestItemList list_; |
| 87 | 90 |
| 88 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); | 91 DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 } // namespace payments | 94 } // namespace payments |
| 92 | 95 |
| 93 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ | 96 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
| OLD | NEW |