| OLD | NEW |
| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 424 } |
| 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( |
| 435 return GetRawInfo(NAME_FIRST) + GetRawInfo(NAME_LAST) + | 435 const std::string& app_locale) const { |
| 436 GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY); | 436 std::vector<base::string16> primary_values{ |
| 437 GetInfo(AutofillType(NAME_FIRST), app_locale), |
| 438 GetInfo(AutofillType(NAME_LAST), app_locale), |
| 439 GetInfo(AutofillType(ADDRESS_HOME_LINE1), app_locale), |
| 440 GetInfo(AutofillType(ADDRESS_HOME_CITY), app_locale)}; |
| 441 return CanonicalizeProfileString( |
| 442 base::JoinString(primary_values, base::UTF8ToUTF16(" "))); |
| 437 } | 443 } |
| 438 | 444 |
| 439 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile, | 445 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile, |
| 440 const std::string& app_locale) const { | 446 const std::string& app_locale) const { |
| 441 ServerFieldTypeSet types; | 447 ServerFieldTypeSet types; |
| 442 GetSupportedTypes(&types); | 448 GetSupportedTypes(&types); |
| 443 return IsSubsetOfForFieldSet(profile, app_locale, types); | 449 return IsSubsetOfForFieldSet(profile, app_locale, types); |
| 444 } | 450 } |
| 445 | 451 |
| 446 bool AutofillProfile::IsSubsetOfForFieldSet( | 452 bool AutofillProfile::IsSubsetOfForFieldSet( |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " | 1090 << " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " " |
| 1085 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " | 1091 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " " |
| 1086 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " | 1092 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " " |
| 1087 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " | 1093 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " " |
| 1088 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " | 1094 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " " |
| 1089 << profile.language_code() << " " | 1095 << profile.language_code() << " " |
| 1090 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); | 1096 << UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); |
| 1091 } | 1097 } |
| 1092 | 1098 |
| 1093 } // namespace autofill | 1099 } // namespace autofill |
| OLD | NEW |