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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 23882013: [rAc] Persist selection of newly added cards and addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests, add a test Created 7 years, 3 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/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 059027f06883b74e691ccb469f204fb9adeaa073..4fa6b089191bd2a26613c9446737affd5daf3c81 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -2675,7 +2675,8 @@ void AutofillDialogControllerImpl::FillOutputForSectionWithComparator(
GetValueFromSection(SECTION_BILLING, NAME_FULL));
if (ShouldSaveDetailsLocally()) {
- GetManager()->SaveImportedCreditCard(card);
+ std::string guid = GetManager()->SaveImportedCreditCard(card);
+ newly_saved_data_model_guids_[section] = guid;
DCHECK(!profile()->IsOffTheRecord());
newly_saved_card_.reset(new CreditCard(card));
}
@@ -2692,8 +2693,10 @@ void AutofillDialogControllerImpl::FillOutputForSectionWithComparator(
profile.set_origin(kAutofillDialogOrigin);
FillFormGroupFromOutputs(output, &profile);
- if (ShouldSaveDetailsLocally())
- SaveProfileGleanedFromSection(profile, section);
+ if (ShouldSaveDetailsLocally()) {
+ std::string guid = GetManager()->SaveImportedProfile(profile);
+ newly_saved_data_model_guids_[section] = guid;
+ }
AutofillProfileWrapper profile_wrapper(&profile);
profile_wrapper.FillFormStructure(inputs, compare, &form_structure_);
@@ -2746,12 +2749,6 @@ string16 AutofillDialogControllerImpl::GetValueFromSection(
return string16();
}
-void AutofillDialogControllerImpl::SaveProfileGleanedFromSection(
- const AutofillProfile& profile,
- DialogSection section) {
- GetManager()->SaveImportedProfile(profile);
-}
-
SuggestionsMenuModel* AutofillDialogControllerImpl::
SuggestionsMenuModelForSection(DialogSection section) {
switch (section) {
@@ -3140,8 +3137,12 @@ void AutofillDialogControllerImpl::DoFinishSubmit() {
SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section);
std::string item_key = model->GetItemKeyForCheckedItem();
- if (IsASuggestionItemKey(item_key) || item_key == kSameAsBillingKey)
+ if (IsASuggestionItemKey(item_key) || item_key == kSameAsBillingKey) {
PersistAutofillChoice(section, item_key);
+ } else if (item_key == kAddNewItemKey && ShouldSaveDetailsLocally()) {
+ DCHECK(newly_saved_data_model_guids_.count(section));
+ PersistAutofillChoice(section, newly_saved_data_model_guids_[section]);
+ }
}
profile_->GetPrefs()->SetBoolean(::prefs::kAutofillDialogSaveData,

Powered by Google App Engine
This is Rietveld 408576698