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

Unified Diff: chrome/browser/autofill/personal_data_manager.cc

Issue 8143007: Move a bunch of non-shared methods out of the FormGroup class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: De-nitting Created 9 years, 2 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 | « chrome/browser/autofill/form_group.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/personal_data_manager.cc
diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc
index db27ffb8fb024f28a0085cca8c931b9355cc305c..e92b9291d86ac39366b59f8822900e2f6113a081 100644
--- a/chrome/browser/autofill/personal_data_manager.cc
+++ b/chrome/browser/autofill/personal_data_manager.cc
@@ -603,53 +603,28 @@ bool PersonalDataManager::MergeProfile(
const AutofillProfile& profile,
const std::vector<AutofillProfile*>& existing_profiles,
std::vector<AutofillProfile>* merged_profiles) {
- DCHECK(merged_profiles);
merged_profiles->clear();
// Set to true if |profile| is merged into |existing_profiles|.
bool merged = false;
- // First preference is to add missing values to an existing profile.
+ // If we have already saved this address, merge in any missing values.
// Only merge with the first match.
for (std::vector<AutofillProfile*>::const_iterator iter =
existing_profiles.begin();
iter != existing_profiles.end(); ++iter) {
if (!merged) {
- if (profile.IsSubsetOf(**iter)) {
- // In this case, the existing profile already contains all of the data
- // in |profile|, so consider the profiles already merged.
+ if (!profile.PrimaryValue().empty() &&
+ StringToLowerASCII((*iter)->PrimaryValue()) ==
+ StringToLowerASCII(profile.PrimaryValue())) {
merged = true;
- } else if ((*iter)->IntersectionOfTypesHasEqualValues(profile)) {
- // |profile| contains all of the data in this profile, plus more.
- merged = true;
- (*iter)->MergeWith(profile);
+ (*iter)->OverwriteWithOrAddTo(profile);
}
}
merged_profiles->push_back(**iter);
}
- // The second preference, if not merged above, is to alter non-primary values
- // where the primary values match.
- // Again, only merge with the first match.
- if (!merged) {
- merged_profiles->clear();
- for (std::vector<AutofillProfile*>::const_iterator iter =
- existing_profiles.begin();
- iter != existing_profiles.end(); ++iter) {
- if (!merged) {
- if (!profile.PrimaryValue().empty() &&
- StringToLowerASCII((*iter)->PrimaryValue()) ==
- StringToLowerASCII(profile.PrimaryValue())) {
- merged = true;
- (*iter)->OverwriteWithOrAddTo(profile);
- }
- }
- merged_profiles->push_back(**iter);
- }
- }
-
- // Finally, if the new profile was not merged with an existing profile then
- // add the new profile to the list.
+ // If the new profile was not merged with an existing one, add it to the list.
if (!merged)
merged_profiles->push_back(profile);
« no previous file with comments | « chrome/browser/autofill/form_group.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698