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

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

Issue 2075503002: [Autofill] Fix the dedupe of verified profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments Created 4 years, 6 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
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 SetRawInfo(field_type, new_value); 567 SetRawInfo(field_type, new_value);
568 did_overwrite = true; 568 did_overwrite = true;
569 } 569 }
570 } 570 }
571 571
572 return did_overwrite; 572 return did_overwrite;
573 } 573 }
574 574
575 bool AutofillProfile::SaveAdditionalInfo(const AutofillProfile& profile, 575 bool AutofillProfile::SaveAdditionalInfo(const AutofillProfile& profile,
576 const std::string& app_locale) { 576 const std::string& app_locale) {
577 // If both profiles are verified, do not merge them.
578 if (IsVerified() && profile.IsVerified())
579 return false;
580
577 ServerFieldTypeSet field_types, other_field_types; 581 ServerFieldTypeSet field_types, other_field_types;
578 GetNonEmptyTypes(app_locale, &field_types); 582 GetNonEmptyTypes(app_locale, &field_types);
579 profile.GetNonEmptyTypes(app_locale, &other_field_types); 583 profile.GetNonEmptyTypes(app_locale, &other_field_types);
580 584
581 // The address needs to be compared line by line to take into account the 585 // The address needs to be compared line by line to take into account the
582 // logic for empty fields implemented in the loop. 586 // logic for empty fields implemented in the loop.
583 field_types.erase(ADDRESS_HOME_STREET_ADDRESS); 587 field_types.erase(ADDRESS_HOME_STREET_ADDRESS);
584 l10n::CaseInsensitiveCompare compare; 588 l10n::CaseInsensitiveCompare compare;
585 for (ServerFieldType field_type : field_types) { 589 for (ServerFieldType field_type : field_types) {
586 if (other_field_types.count(field_type)) { 590 if (other_field_types.count(field_type)) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 1019 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
1016 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 1020 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
1017 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 1021 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
1018 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 1022 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
1019 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 1023 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
1020 << profile.language_code() << " " 1024 << profile.language_code() << " "
1021 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 1025 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
1022 } 1026 }
1023 1027
1024 } // namespace autofill 1028 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698