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

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

Issue 962673004: [Autofill/Autocomplete Feature] Substring matching instead of prefix matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Vaclav's inputs unittests. Created 5 years, 9 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/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 617c9dc09190b9cd674e514ba91063669bb4b87a..cc0f789d3b1ac07f1707c94e45c7f2c61cf9c9ec 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -29,6 +29,7 @@
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
+#include "components/autofill/core/common/autofill_util.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
@@ -839,8 +840,10 @@ std::vector<Suggestion> PersonalDataManager::GetProfileSuggestions(
base::string16 value_canon =
AutofillProfile::CanonicalizeProfileString(values[i]);
- if (StartsWith(value_canon, field_contents_canon, true)) {
- // Prefix match, add suggestion.
+ if (StartsWith(value_canon, field_contents_canon, true) ||
+ (IsFeatureSubstringMatchEnabled() &&
+ IsContentsPrefixOfSuggestionToken(values[i], field_contents,
+ true))) {
matched_profiles.push_back(profile);
suggestions.push_back(Suggestion(values[i]));
suggestions.back().backend_id.guid = profile->guid();

Powered by Google App Engine
This is Rietveld 408576698