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

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

Issue 2972973002: [Payments] When saving an edited address in editor, clear data first. (Closed)
Patch Set: addressed comments Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7a546aef74507b7ec24f759d133459cf7b31038a..f71b655f4ade104a22e2f28a3f727702e5d095fe 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
@@ -119,10 +119,16 @@ bool ShippingAddressEditorViewController::ValidateModelAndSave() {
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
- // object needs to retain other properties (use count, use date, guid,
+ autofill::ServerFieldTypeSet all_fields;
+ profile_to_edit_->GetSupportedTypes(&all_fields);
+ // Clear all the address data in |profile_to_edit_|, in anticipation of
+ // adding only the fields present in the editor. Prefer this method to
+ // copying |profile| into |profile_to_edit_|, because the latter object
+ // needs to retain other properties (use count, use date, guid,
// etc.).
+ for (autofill::ServerFieldType type : all_fields)
+ profile_to_edit_->SetRawInfo(type, base::string16());
+
bool success = SaveFieldsToProfile(profile_to_edit_,
/*ignore_errors=*/false);
DCHECK(success);
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698