| 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 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 9 #include "components/payments/content/payment_request.h" | 9 #include "components/payments/content/payment_request.h" |
| 10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ShippingProfileViewController(PaymentRequest* request, | 87 ShippingProfileViewController(PaymentRequest* request, |
| 88 PaymentRequestDialogView* dialog) | 88 PaymentRequestDialogView* dialog) |
| 89 : ProfileListViewController(request, dialog) {} | 89 : ProfileListViewController(request, dialog) {} |
| 90 ~ShippingProfileViewController() override {} | 90 ~ShippingProfileViewController() override {} |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 // ProfileListViewController: | 93 // ProfileListViewController: |
| 94 std::unique_ptr<views::View> GetLabel( | 94 std::unique_ptr<views::View> GetLabel( |
| 95 autofill::AutofillProfile* profile) override { | 95 autofill::AutofillProfile* profile) override { |
| 96 return GetShippingAddressLabel(AddressStyleType::DETAILED, | 96 return GetShippingAddressLabel(AddressStyleType::DETAILED, |
| 97 request()->GetApplicationLocale(), *profile); | 97 request()->state()->GetApplicationLocale(), |
| 98 *profile); |
| 98 } | 99 } |
| 99 | 100 |
| 100 std::vector<autofill::AutofillProfile*> GetProfiles() override { | 101 std::vector<autofill::AutofillProfile*> GetProfiles() override { |
| 101 return request()->state()->shipping_profiles(); | 102 return request()->state()->shipping_profiles(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 base::string16 GetHeaderString() override { | 105 base::string16 GetHeaderString() override { |
| 105 return GetShippingAddressSectionString( | 106 return GetShippingAddressSectionString( |
| 106 request()->spec()->options().shipping_type); | 107 request()->spec()->options().shipping_type); |
| 107 } | 108 } |
| 108 | 109 |
| 109 private: | 110 private: |
| 110 DISALLOW_COPY_AND_ASSIGN(ShippingProfileViewController); | 111 DISALLOW_COPY_AND_ASSIGN(ShippingProfileViewController); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 class ContactProfileViewController : public ProfileListViewController { | 114 class ContactProfileViewController : public ProfileListViewController { |
| 114 public: | 115 public: |
| 115 ContactProfileViewController(PaymentRequest* request, | 116 ContactProfileViewController(PaymentRequest* request, |
| 116 PaymentRequestDialogView* dialog) | 117 PaymentRequestDialogView* dialog) |
| 117 : ProfileListViewController(request, dialog) {} | 118 : ProfileListViewController(request, dialog) {} |
| 118 ~ContactProfileViewController() override {} | 119 ~ContactProfileViewController() override {} |
| 119 | 120 |
| 120 protected: | 121 protected: |
| 121 // ProfileListViewController: | 122 // ProfileListViewController: |
| 122 std::unique_ptr<views::View> GetLabel( | 123 std::unique_ptr<views::View> GetLabel( |
| 123 autofill::AutofillProfile* profile) override { | 124 autofill::AutofillProfile* profile) override { |
| 124 return GetContactInfoLabel(AddressStyleType::DETAILED, | 125 return GetContactInfoLabel( |
| 125 request()->GetApplicationLocale(), *profile, | 126 AddressStyleType::DETAILED, request()->state()->GetApplicationLocale(), |
| 126 request()->spec()->request_payer_name(), | 127 *profile, request()->spec()->request_payer_name(), |
| 127 request()->spec()->request_payer_phone(), | 128 request()->spec()->request_payer_phone(), |
| 128 request()->spec()->request_payer_email()); | 129 request()->spec()->request_payer_email()); |
| 129 } | 130 } |
| 130 | 131 |
| 131 std::vector<autofill::AutofillProfile*> GetProfiles() override { | 132 std::vector<autofill::AutofillProfile*> GetProfiles() override { |
| 132 return request()->state()->contact_profiles(); | 133 return request()->state()->contact_profiles(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 base::string16 GetHeaderString() override { | 136 base::string16 GetHeaderString() override { |
| 136 return l10n_util::GetStringUTF16( | 137 return l10n_util::GetStringUTF16( |
| 137 IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME); | 138 IDS_PAYMENT_REQUEST_CONTACT_INFO_SECTION_NAME); |
| 138 } | 139 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 profile, request(), &list_, this, profile == selected_profile)); | 178 profile, request(), &list_, this, profile == selected_profile)); |
| 178 } | 179 } |
| 179 | 180 |
| 180 return CreatePaymentView( | 181 return CreatePaymentView( |
| 181 CreateSheetHeaderView( | 182 CreateSheetHeaderView( |
| 182 /* show_back_arrow = */ true, GetHeaderString(), this), | 183 /* show_back_arrow = */ true, GetHeaderString(), this), |
| 183 list_.CreateListView()); | 184 list_.CreateListView()); |
| 184 } | 185 } |
| 185 | 186 |
| 186 } // namespace payments | 187 } // namespace payments |
| OLD | NEW |