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

Unified Diff: components/autofill/core/browser/autofill_profile.cc

Issue 970403002: Don't suggest autofill profiles that are subsets of other profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: components/autofill/core/browser/autofill_profile.cc
diff --git a/components/autofill/core/browser/autofill_profile.cc b/components/autofill/core/browser/autofill_profile.cc
index 8b96c6549e3337a09a2572cec7bd4d2c826bd8a4..28e45b956fe91b0293c5ac97743d345b32c3ca62 100644
--- a/components/autofill/core/browser/autofill_profile.cc
+++ b/components/autofill/core/browser/autofill_profile.cc
@@ -565,9 +565,19 @@ const base::string16 AutofillProfile::PrimaryValue() const {
bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile,
const std::string& app_locale) const {
ServerFieldTypeSet types;
- GetNonEmptyTypes(app_locale, &types);
+ GetSupportedTypes(&types);
+ return IsSubsetOfForFieldSet(profile, app_locale, types);
+}
+bool AutofillProfile::IsSubsetOfForFieldSet(
+ const AutofillProfile& profile,
+ const std::string& app_locale,
+ const ServerFieldTypeSet& types) const {
for (ServerFieldType type : types) {
+ base::string16 value = GetRawInfo(type);
+ if (value.empty())
+ continue;
+
if (type == NAME_FULL || type == ADDRESS_HOME_STREET_ADDRESS) {
// Ignore the compound "full name" field type. We are only interested in
// comparing the constituent parts. For example, if |this| has a middle
@@ -580,12 +590,12 @@ bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile,
if (type != PHONE_HOME_WHOLE_NUMBER) {
continue;
} else if (!i18n::PhoneNumbersMatch(
- GetRawInfo(type), profile.GetRawInfo(type),
+ value, profile.GetRawInfo(type),
base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)),
app_locale)) {
return false;
}
- } else if (base::StringToLowerASCII(GetRawInfo(type)) !=
+ } else if (base::StringToLowerASCII(value) !=
base::StringToLowerASCII(profile.GetRawInfo(type))) {
return false;
}
« no previous file with comments | « components/autofill/core/browser/autofill_profile.h ('k') | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698