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..c748c7fd0a6a4bdfec5edec8d5339660695ac9c0 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.h |
| @@ -0,0 +1,73 @@ |
| +// 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 <memory> |
| +#include <vector> |
| + |
| +#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; |
| +} |
| + |
|
please use gerrit instead
2017/03/10 20:23:12
namespace views {
class Button;
}
tmartino
2017/03/10 23:46:23
Done. Also added View
|
| +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; |
| + |
| + // Returns the string displayed at the top of the view. |
| + virtual base::string16 GetHeaderString() = 0; |
| + |
| + PaymentRequest* request_; |
|
please use gerrit instead
2017/03/10 20:23:12
Add a comment: "// Not owned. Never null. Outlives
tmartino
2017/03/10 23:46:23
Done
|
| + |
| + private: |
| + std::unique_ptr<views::Button> CreateRow(autofill::AutofillProfile* profile); |
| + PaymentRequestItemList list_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ProfileListViewController); |
| +}; |
| + |
| +} // namespace payments |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PROFILE_LIST_VIEW_CONTROLLER_H_ |