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

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

Issue 2681703002: Use regular weight for password autofill popup on password field. (Closed)
Patch Set: Compilation error on win fix Created 3 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/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 903350306b6ed3c29d0000a63564b7cad5d5675b..306f206abd99105342d3e0867dbb1246f3d6bd1f 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 AppendSuggestionIfMatching(
const base::string16& field_contents,
const std::string& signon_realm,
bool show_all,
+ bool is_password_field,
std::vector<autofill::Suggestion>* suggestions) {
base::string16 lower_suggestion = base::i18n::ToLower(field_suggestion);
base::string16 lower_contents = base::i18n::ToLower(field_contents);
@@ -83,7 +84,9 @@ void AppendSuggestionIfMatching(
lower_suggestion, lower_contents, true)) {
autofill::Suggestion suggestion(ReplaceEmptyUsername(field_suggestion));
suggestion.label = GetHumanReadableRealm(signon_realm);
- suggestion.frontend_id = autofill::POPUP_ITEM_ID_PASSWORD_ENTRY;
+ suggestion.frontend_id = is_password_field
+ ? autofill::POPUP_ITEM_ID_PASSWORD_ENTRY
+ : autofill::POPUP_ITEM_ID_USERNAME_ENTRY;
suggestion.match = prefix_matched_suggestion
? autofill::Suggestion::PREFIX_MATCH
: autofill::Suggestion::SUBSTRING_MATCH;
@@ -97,19 +100,23 @@ void AppendSuggestionIfMatching(
void GetSuggestions(const autofill::PasswordFormFillData& fill_data,
const base::string16& current_username,
std::vector<autofill::Suggestion>* suggestions,
- bool show_all) {
+ bool show_all,
+ bool is_password_field) {
AppendSuggestionIfMatching(fill_data.username_field.value, current_username,
- fill_data.preferred_realm, show_all, suggestions);
+ fill_data.preferred_realm, show_all,
+ is_password_field, suggestions);
for (const auto& login : fill_data.additional_logins) {
AppendSuggestionIfMatching(login.first, current_username,
- login.second.realm, show_all, suggestions);
+ login.second.realm, show_all, is_password_field,
+ suggestions);
}
for (const auto& usernames : fill_data.other_possible_usernames) {
for (size_t i = 0; i < usernames.second.size(); ++i) {
AppendSuggestionIfMatching(usernames.second[i], current_username,
- usernames.first.realm, show_all, suggestions);
+ usernames.first.realm, show_all,
+ is_password_field, suggestions);
}
}
@@ -194,7 +201,8 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
return;
}
GetSuggestions(fill_data_it->second, typed_username, &suggestions,
- options & autofill::SHOW_ALL);
+ (options & autofill::SHOW_ALL) != 0,
+ (options & autofill::IS_PASSWORD_FIELD) != 0);
form_data_key_ = key;

Powered by Google App Engine
This is Rietveld 408576698