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

Side by Side Diff: components/autofill/core/browser/autofill_profile.cc

Issue 2142123002: [Autofill] Run autofill-profile de-dupe after sync starts if sync is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better logging and fix mathp's comments Created 4 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 unified diff | Download patch
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/autofill_profile.h" 5 #include "components/autofill/core/browser/autofill_profile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 DCHECK(!IsVerified() || profile.IsVerified()); 439 DCHECK(!IsVerified() || profile.IsVerified());
440 AutofillProfileComparator comparator(app_locale); 440 AutofillProfileComparator comparator(app_locale);
441 DCHECK(comparator.AreMergeable(*this, profile)); 441 DCHECK(comparator.AreMergeable(*this, profile));
442 442
443 NameInfo name; 443 NameInfo name;
444 EmailInfo email; 444 EmailInfo email;
445 CompanyInfo company; 445 CompanyInfo company;
446 PhoneNumber phone_number(this); 446 PhoneNumber phone_number(this);
447 Address address; 447 Address address;
448 448
449 DVLOG(1) << "Merging profiles:\nSource = " << profile << "\nDest = " << *this;
450
449 // The comparator's merge operations are biased to prefer the data in the 451 // The comparator's merge operations are biased to prefer the data in the
450 // first profile parameter when the data is the same modulo case. We pass the 452 // first profile parameter when the data is the same modulo case. We pass the
451 // incoming profile in this position to prefer accepting updates instead of 453 // incoming profile in this position to prefer accepting updates instead of
452 // preserving the original data. I.e., passing the incoming profile first 454 // preserving the original data. I.e., passing the incoming profile first
453 // accepts case changes, the other ways does not. 455 // accepts case changes, the other ways does not.
454 if (!comparator.MergeNames(profile, *this, &name) || 456 if (!comparator.MergeNames(profile, *this, &name) ||
455 !comparator.MergeEmailAddresses(profile, *this, &email) || 457 !comparator.MergeEmailAddresses(profile, *this, &email) ||
456 !comparator.MergeCompanyNames(profile, *this, &company) || 458 !comparator.MergeCompanyNames(profile, *this, &company) ||
457 !comparator.MergePhoneNumbers(profile, *this, &phone_number) || 459 !comparator.MergePhoneNumbers(profile, *this, &phone_number) ||
458 !comparator.MergeAddresses(profile, *this, &address)) { 460 !comparator.MergeAddresses(profile, *this, &address)) {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 846 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
845 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
846 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
847 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 849 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
848 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 850 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
849 << profile.language_code() << " " 851 << profile.language_code() << " "
850 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 852 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
851 } 853 }
852 854
853 } // namespace autofill 855 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/autofill_profile_comparator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698