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

Unified Diff: components/password_manager/core/browser/password_autofill_manager.cc

Issue 1208133002: [Autofill/Autocomplete Feature] Substring matching instead of prefix matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added |match_start| usage. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/password_autofill_manager.cc
diff --git a/components/password_manager/core/browser/password_autofill_manager.cc b/components/password_manager/core/browser/password_autofill_manager.cc
index a7a71085d9f864199eab2892a8f79ac65636e17c..bc88d88b4765103e4a9ef14bdfeeb33e97eca2d3 100644
--- a/components/password_manager/core/browser/password_autofill_manager.cc
+++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -72,6 +72,7 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data,
ReplaceEmptyUsername(fill_data.username_field.value));
suggestion.label = GetHumanReadableRealm(fill_data.preferred_realm);
suggestion.frontend_id = autofill::POPUP_ITEM_ID_PASSWORD_ENTRY;
+ suggestion.match_start = current_username.size();
suggestions->push_back(suggestion);
}
@@ -80,6 +81,7 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data,
autofill::Suggestion suggestion(ReplaceEmptyUsername(login.first));
suggestion.label = GetHumanReadableRealm(login.second.realm);
suggestion.frontend_id = autofill::POPUP_ITEM_ID_PASSWORD_ENTRY;
+ suggestion.match_start = current_username.size();
suggestions->push_back(suggestion);
}
}
@@ -92,6 +94,7 @@ void GetSuggestions(const autofill::PasswordFormFillData& fill_data,
ReplaceEmptyUsername(usernames.second[i]));
suggestion.label = GetHumanReadableRealm(usernames.first.realm);
suggestion.frontend_id = autofill::POPUP_ITEM_ID_PASSWORD_ENTRY;
+ suggestion.match_start = current_username.size();
suggestions->push_back(suggestion);
}
}
@@ -131,16 +134,16 @@ bool PasswordAutofillManager::FillSuggestion(int key,
return false;
}
-bool PasswordAutofillManager::PreviewSuggestion(
- int key,
- const base::string16& username) {
+bool PasswordAutofillManager::PreviewSuggestion(int key,
+ const base::string16& username,
+ size_t match_start) {
autofill::PasswordFormFillData fill_data;
autofill::PasswordAndRealm password_and_realm;
if (FindLoginInfo(key, &fill_data) &&
GetPasswordAndRealmForUsername(
username, fill_data, &password_and_realm)) {
password_manager_driver_->PreviewSuggestion(
- username, password_and_realm.password);
+ username, password_and_realm.password, match_start);
return true;
}
return false;
@@ -203,8 +206,9 @@ bool PasswordAutofillManager::FillSuggestionForTest(
bool PasswordAutofillManager::PreviewSuggestionForTest(
int key,
- const base::string16& username) {
- return PreviewSuggestion(key, username);
+ const base::string16& username,
+ size_t match_start) {
+ return PreviewSuggestion(key, username, match_start);
}
void PasswordAutofillManager::OnPopupShown() {
@@ -214,9 +218,10 @@ void PasswordAutofillManager::OnPopupHidden() {
}
void PasswordAutofillManager::DidSelectSuggestion(const base::string16& value,
- int identifier) {
+ int identifier,
+ size_t match_start) {
ClearPreviewedForm();
- bool success = PreviewSuggestion(form_data_key_, value);
+ bool success = PreviewSuggestion(form_data_key_, value, match_start);
DCHECK(success);
}

Powered by Google App Engine
This is Rietveld 408576698