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

Unified Diff: chrome/browser/ui/views/payments/profile_list_view_controller.cc

Issue 2759253002: [Web Payments] Implement item selection in lists. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/profile_list_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
index 02d4b5cd0c973f43a0b6f41b00d44e0329e4eec8..37c85dd330fd76546f980bf4f4f97645fc52410b 100644
--- a/chrome/browser/ui/views/payments/profile_list_view_controller.cc
+++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -45,7 +45,10 @@ class ProfileItem : public PaymentRequestItemList::Item {
return parent_view_->GetLabel(profile_);
}
- void SelectedStateChanged() override {}
+ void SelectedStateChanged() override {
+ if (selected())
+ parent_view_->SelectProfile(profile_);
+ }
bool CanBeSelected() const override {
// TODO(anthonyvd): Check for profile completedness.
@@ -80,6 +83,14 @@ class ShippingProfileViewController : public ProfileListViewController {
state()->GetApplicationLocale(), *profile);
}
+ void SelectProfile(autofill::AutofillProfile* profile) override {
+ state()->SetSelectedShippingProfile(profile);
+ }
+
+ autofill::AutofillProfile* GetSelectedProfile() override {
+ return state()->selected_shipping_profile();
+ }
+
std::vector<autofill::AutofillProfile*> GetProfiles() override {
return state()->shipping_profiles();
}
@@ -110,6 +121,14 @@ class ContactProfileViewController : public ProfileListViewController {
spec()->request_payer_email());
}
+ void SelectProfile(autofill::AutofillProfile* profile) override {
+ state()->SetSelectedContactProfile(profile);
+ }
+
+ autofill::AutofillProfile* GetSelectedProfile() override {
+ return state()->selected_contact_profile();
+ }
+
std::vector<autofill::AutofillProfile*> GetProfiles() override {
return state()->contact_profiles();
}
@@ -147,13 +166,12 @@ ProfileListViewController::ProfileListViewController(
PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog)
- : PaymentRequestSheetController(spec, state, dialog) {}
+ : PaymentRequestSheetController(spec, state, dialog), list_(dialog) {}
ProfileListViewController::~ProfileListViewController() {}
std::unique_ptr<views::View> ProfileListViewController::CreateView() {
- autofill::AutofillProfile* selected_profile =
- state()->selected_shipping_profile();
+ autofill::AutofillProfile* selected_profile = GetSelectedProfile();
// This must be done at Create-time, rather than construct-time, because
// the subclass method GetProfiles can't be called in the ctor.

Powered by Google App Engine
This is Rietveld 408576698