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_dialog_view.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 state()->GetApplicationLocale(), *profile, | 110 state()->GetApplicationLocale(), *profile, |
111 *spec(), *(state()->profile_comparator())); | 111 *spec(), *(state()->profile_comparator())); |
112 } | 112 } |
113 | 113 |
114 void SelectProfile(autofill::AutofillProfile* profile) override { | 114 void SelectProfile(autofill::AutofillProfile* profile) override { |
115 state()->SetSelectedShippingProfile(profile); | 115 state()->SetSelectedShippingProfile(profile); |
116 } | 116 } |
117 | 117 |
118 void ShowEditor(autofill::AutofillProfile* profile) override { | 118 void ShowEditor(autofill::AutofillProfile* profile) override { |
119 dialog()->ShowShippingAddressEditor( | 119 dialog()->ShowShippingAddressEditor( |
120 /*on_edited=*/base::BindOnce( | 120 BackNavigationType::kPaymentSheet, |
121 &PaymentRequestState::SetSelectedShippingProfile, | 121 /*on_edited=*/ |
122 base::Unretained(state()), profile), | 122 base::BindOnce(&PaymentRequestState::SetSelectedShippingProfile, |
| 123 base::Unretained(state()), profile), |
123 /*on_added=*/ | 124 /*on_added=*/ |
124 base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile, | 125 base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile, |
125 base::Unretained(state()), /*selected=*/true), | 126 base::Unretained(state()), /*selected=*/true), |
126 profile); | 127 profile); |
127 } | 128 } |
128 | 129 |
129 autofill::AutofillProfile* GetSelectedProfile() override { | 130 autofill::AutofillProfile* GetSelectedProfile() override { |
130 return state()->selected_shipping_profile(); | 131 return state()->selected_shipping_profile(); |
131 } | 132 } |
132 | 133 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return GetContactInfoLabel(AddressStyleType::DETAILED, | 181 return GetContactInfoLabel(AddressStyleType::DETAILED, |
181 state()->GetApplicationLocale(), *profile, | 182 state()->GetApplicationLocale(), *profile, |
182 *spec(), *(state()->profile_comparator())); | 183 *spec(), *(state()->profile_comparator())); |
183 } | 184 } |
184 | 185 |
185 void SelectProfile(autofill::AutofillProfile* profile) override { | 186 void SelectProfile(autofill::AutofillProfile* profile) override { |
186 state()->SetSelectedContactProfile(profile); | 187 state()->SetSelectedContactProfile(profile); |
187 } | 188 } |
188 | 189 |
189 void ShowEditor(autofill::AutofillProfile* profile) override { | 190 void ShowEditor(autofill::AutofillProfile* profile) override { |
190 dialog()->ShowContactInfoEditor(profile); | 191 dialog()->ShowContactInfoEditor(BackNavigationType::kPaymentSheet, profile); |
191 } | 192 } |
192 | 193 |
193 autofill::AutofillProfile* GetSelectedProfile() override { | 194 autofill::AutofillProfile* GetSelectedProfile() override { |
194 return state()->selected_contact_profile(); | 195 return state()->selected_contact_profile(); |
195 } | 196 } |
196 | 197 |
197 bool IsValidProfile(const autofill::AutofillProfile& profile) override { | 198 bool IsValidProfile(const autofill::AutofillProfile& profile) override { |
198 return state()->profile_comparator()->IsContactInfoComplete(&profile); | 199 return state()->profile_comparator()->IsContactInfoComplete(&profile); |
199 } | 200 } |
200 | 201 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 294 |
294 void ProfileListViewController::ButtonPressed(views::Button* sender, | 295 void ProfileListViewController::ButtonPressed(views::Button* sender, |
295 const ui::Event& event) { | 296 const ui::Event& event) { |
296 if (sender->tag() == GetSecondaryButtonTag()) | 297 if (sender->tag() == GetSecondaryButtonTag()) |
297 ShowEditor(nullptr); | 298 ShowEditor(nullptr); |
298 else | 299 else |
299 PaymentRequestSheetController::ButtonPressed(sender, event); | 300 PaymentRequestSheetController::ButtonPressed(sender, event); |
300 } | 301 } |
301 | 302 |
302 } // namespace payments | 303 } // namespace payments |
OLD | NEW |