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

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: Incorporates Evan's review comments. Created 5 years, 7 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 5d234adfaac692e3be272d361ac51b9cef83bd2f..9ee14cbad06ce42cf7cf493b746d63641fa68748 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -30,6 +30,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/browser/account_tracker_service.h"
#include "components/signin/core/common/signin_pref_names.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
@@ -870,8 +871,8 @@ 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) ||
+ IsContentsPrefixOfSuggestionToken(values[i], field_contents, false)) {
Evan Stade 2015/05/22 18:26:48 to match the naming format of StartsWith, can you
Pritam Nikam 2015/05/25 18:14:51 Done.
matched_profiles.push_back(profile);
suggestions.push_back(Suggestion(values[i]));
suggestions.back().backend_id.guid = profile->guid();
@@ -946,7 +947,9 @@ std::vector<Suggestion> PersonalDataManager::GetCreditCardSuggestions(
field_contents.size() >= 6)) {
continue;
}
- } else if (!StartsWith(creditcard_field_value, field_contents, false)) {
+ } else if (!StartsWith(creditcard_field_value, field_contents, false) &&
+ !IsContentsPrefixOfSuggestionToken(creditcard_field_value,
+ field_contents, false)) {
continue;
}

Powered by Google App Engine
This is Rietveld 408576698