Chromium Code Reviews| Index: chrome/browser/ui/views/payments/profile_list_view_controller.h |
| diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.h b/chrome/browser/ui/views/payments/profile_list_view_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7257002dd29fb6514ff5b380d482029217f98792 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "chrome/browser/ui/views/payments/payment_request_item_list.h" |
| +#include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| + |
| +namespace autofill { |
| +class AutofillProfile; |
| +} |
| + |
| +namespace payments { |
| + |
| +class PaymentRequest; |
| +class PaymentRequestDialogView; |
| + |
| +// This base class encapsulates common view logic for contexts which display |
| +// a list of profiles and allow exactly one of them to be selected. |
| +class ProfileListViewController : public PaymentRequestSheetController { |
| + public: |
| + ~ProfileListViewController() override; |
| + |
| + // Creates a controller which lists and allows selection of profiles |
| + // for shipping address. |
| + static std::unique_ptr<ProfileListViewController> |
| + GetShippingProfileViewController(PaymentRequest* request, |
| + PaymentRequestDialogView* dialog); |
| + |
| + // Creates a controller which lists and allows selection of profiles |
| + // for contact info. |
| + static std::unique_ptr<ProfileListViewController> |
| + GetContactProfileViewController(PaymentRequest* request, |
| + PaymentRequestDialogView* dialog); |
| + |
| + // PaymentRequestSheetController: |
| + std::unique_ptr<views::View> CreateView() override; |
| + |
| + // Returns a representation of the given profile appropriate for display |
| + // in this context. |
| + virtual std::unique_ptr<views::View> GetLabel( |
| + autofill::AutofillProfile* profile) = 0; |
| + |
| + protected: |
| + // Does not take ownership of the arguments, which should outlive this object. |
| + ProfileListViewController(PaymentRequest* request, |
| + PaymentRequestDialogView* dialog); |
| + |
| + // Returns the profiles cached by |request| which are appropriate for display |
| + // in this context. |
| + 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
|
| + |
| + // Returns the string displayed at the top of the view. |
| + virtual base::string16 GetHeaderString() = 0; |
| + |
| + private: |
| + 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
|
| + PaymentRequestItemList list_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
| +}; |
| + |
| +} // namespace payments |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |