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

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

Issue 1989173005: [Autofill] Dedupe similar profiles on insertion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 bool AutofillProfile::operator==(const AutofillProfile& profile) const { 426 bool AutofillProfile::operator==(const AutofillProfile& profile) const {
427 return guid() == profile.guid() && EqualsSansGuid(profile); 427 return guid() == profile.guid() && EqualsSansGuid(profile);
428 } 428 }
429 429
430 bool AutofillProfile::operator!=(const AutofillProfile& profile) const { 430 bool AutofillProfile::operator!=(const AutofillProfile& profile) const {
431 return !operator==(profile); 431 return !operator==(profile);
432 } 432 }
433 433
434 const base::string16 AutofillProfile::PrimaryValue() const { 434 const base::string16 AutofillProfile::PrimaryValue() const {
435 return GetRawInfo(NAME_FIRST) + GetRawInfo(NAME_LAST) + 435 std::vector<std::string> primary_values{
436 GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY); 436 base::UTF16ToUTF8(GetRawInfo(NAME_FIRST)),
437 base::UTF16ToUTF8(GetRawInfo(NAME_LAST)),
438 base::UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_LINE1)),
439 base::UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_CITY))};
Roger McFarlane (Chromium) 2016/06/08 18:55:38 GetInfo() instead of GetRawInfo()?
sebsg 2016/06/08 21:58:46 Done.
440 return base::UTF8ToUTF16(base::JoinString(primary_values, " "));
Mathieu 2016/06/08 18:32:24 can't you use the string16 version of JoinString?
sebsg 2016/06/08 21:58:46 Done.
437 } 441 }
438 442
439 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile, 443 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile,
440 const std::string& app_locale) const { 444 const std::string& app_locale) const {
441 ServerFieldTypeSet types; 445 ServerFieldTypeSet types;
442 GetSupportedTypes(&types); 446 GetSupportedTypes(&types);
443 return IsSubsetOfForFieldSet(profile, app_locale, types); 447 return IsSubsetOfForFieldSet(profile, app_locale, types);
444 } 448 }
445 449
446 bool AutofillProfile::IsSubsetOfForFieldSet( 450 bool AutofillProfile::IsSubsetOfForFieldSet(
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " 1088 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
1085 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " 1089 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
1086 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " 1090 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
1087 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " 1091 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
1088 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " 1092 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
1089 << profile.language_code() << " " 1093 << profile.language_code() << " "
1090 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); 1094 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
1091 } 1095 }
1092 1096
1093 } // namespace autofill 1097 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698