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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table.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 test compile 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/webdata/autofill_table.h" 5 #include "components/autofill/core/browser/webdata/autofill_table.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 AddAutofillProfileNamesToProfile(db_, profile.get()); 2088 AddAutofillProfileNamesToProfile(db_, profile.get());
2089 2089
2090 // Get associated email info. 2090 // Get associated email info.
2091 AddAutofillProfileEmailsToProfile(db_, profile.get()); 2091 AddAutofillProfileEmailsToProfile(db_, profile.get());
2092 2092
2093 // Get associated phone info. 2093 // Get associated phone info.
2094 AddAutofillProfilePhonesToProfile(db_, profile.get()); 2094 AddAutofillProfilePhonesToProfile(db_, profile.get());
2095 2095
2096 if (PersonalDataManager::IsValidLearnableProfile(*profile, app_locale_)) { 2096 if (PersonalDataManager::IsValidLearnableProfile(*profile, app_locale_)) {
2097 std::vector<AutofillProfile> merged_profiles; 2097 std::vector<AutofillProfile> merged_profiles;
2098 bool merged = PersonalDataManager::MergeProfile( 2098 std::string merged_guid = PersonalDataManager::MergeProfile(
2099 *profile, accumulated_profiles_p, app_locale_, &merged_profiles); 2099 *profile, accumulated_profiles_p, app_locale_, &merged_profiles);
2100 2100
2101 std::swap(accumulated_profiles, merged_profiles); 2101 std::swap(accumulated_profiles, merged_profiles);
2102 2102
2103 accumulated_profiles_p.clear(); 2103 accumulated_profiles_p.clear();
2104 accumulated_profiles_p.resize(accumulated_profiles.size()); 2104 accumulated_profiles_p.resize(accumulated_profiles.size());
2105 std::transform(accumulated_profiles.begin(), 2105 std::transform(accumulated_profiles.begin(),
2106 accumulated_profiles.end(), 2106 accumulated_profiles.end(),
2107 accumulated_profiles_p.begin(), 2107 accumulated_profiles_p.begin(),
2108 address_of<AutofillProfile>); 2108 address_of<AutofillProfile>);
2109 2109
2110 // If the profile got merged trash the original. 2110 // If the profile got merged trash the original.
2111 if (merged) 2111 if (merged_guid != profile->guid())
2112 AddAutofillGUIDToTrash(profile->guid()); 2112 AddAutofillGUIDToTrash(profile->guid());
2113
2114 } else { 2113 } else {
2115 // An invalid profile, so trash it. 2114 // An invalid profile, so trash it.
2116 AddAutofillGUIDToTrash(profile->guid()); 2115 AddAutofillGUIDToTrash(profile->guid());
2117 } 2116 }
2118 } // endwhile 2117 } // endwhile
2119 if (!s.Succeeded()) 2118 if (!s.Succeeded())
2120 return false; 2119 return false;
2121 2120
2122 // Drop the current profiles. 2121 // Drop the current profiles.
2123 if (!ClearAutofillProfiles()) 2122 if (!ClearAutofillProfiles())
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 if (!db_->DoesColumnExist("credit_cards", "origin") && 2183 if (!db_->DoesColumnExist("credit_cards", "origin") &&
2185 !db_->Execute("ALTER TABLE credit_cards " 2184 !db_->Execute("ALTER TABLE credit_cards "
2186 "ADD COLUMN origin VARCHAR DEFAULT ''")) { 2185 "ADD COLUMN origin VARCHAR DEFAULT ''")) {
2187 return false; 2186 return false;
2188 } 2187 }
2189 2188
2190 return transaction.Commit(); 2189 return transaction.Commit();
2191 } 2190 }
2192 2191
2193 } // namespace autofill 2192 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698