| Index: chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
|
| diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
|
| index e6babf41d8909d0a28b11b2f3a91a2cead55fb87..1a868b56c4822af0b3ac0138695b2aa2295c5c3b 100644
|
| --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
|
| +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
|
| @@ -67,8 +67,12 @@ ShippingAddressEditorViewController::ShippingAddressEditorViewController(
|
| PaymentRequestSpec* spec,
|
| PaymentRequestState* state,
|
| PaymentRequestDialogView* dialog,
|
| + base::OnceClosure on_edited,
|
| + base::OnceCallback<void(const autofill::AutofillProfile&)> on_added,
|
| autofill::AutofillProfile* profile)
|
| : EditorViewController(spec, state, dialog),
|
| + on_edited_(std::move(on_edited)),
|
| + on_added_(std::move(on_added)),
|
| profile_to_edit_(profile),
|
| chosen_country_index_(0),
|
| failed_to_load_region_data_(false) {
|
| @@ -113,6 +117,8 @@ bool ShippingAddressEditorViewController::ValidateModelAndSave() {
|
| // Add the profile (will not add a duplicate).
|
| profile.set_origin(autofill::kSettingsOrigin);
|
| state()->GetPersonalDataManager()->AddProfile(profile);
|
| + std::move(on_added_).Run(profile);
|
| + on_edited_.Reset();
|
| } else {
|
| // Copy the temporary object's data to the object to be edited. Prefer this
|
| // method to copying |profile| into |profile_to_edit_|, because the latter
|
| @@ -123,6 +129,8 @@ bool ShippingAddressEditorViewController::ValidateModelAndSave() {
|
| DCHECK(success);
|
| profile_to_edit_->set_origin(autofill::kSettingsOrigin);
|
| state()->GetPersonalDataManager()->UpdateProfile(*profile_to_edit_);
|
| + std::move(on_edited_).Run();
|
| + on_added_.Reset();
|
| }
|
|
|
| return true;
|
|
|