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

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

Issue 767353002: Support for password manager suggestions on password fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Address gcasto's comments Created 6 years 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 810e09dce70cf105a5d806d2fbf07792b81734c0..46ffc479c5e5ffdeafea44f6f30ac91117789232 100644
--- a/components/password_manager/core/browser/password_autofill_manager.cc
+++ b/components/password_manager/core/browser/password_autofill_manager.cc
@@ -15,6 +15,8 @@
#include "components/autofill/core/common/autofill_data_validation.h"
#include "components/password_manager/core/browser/password_manager_client.h"
#include "components/password_manager/core/browser/password_manager_driver.h"
+#include "components/strings/grit/components_strings.h"
+#include "ui/base/l10n/l10n_util.h"
namespace password_manager {
@@ -108,8 +110,18 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
int key,
base::i18n::TextDirection text_direction,
const base::string16& typed_username,
- bool show_all,
+ int options,
const gfx::RectF& bounds) {
+ bool show_all =
Evan Stade 2014/12/03 17:54:50 nit: declare variables where they're used rather t
jww 2014/12/04 18:59:56 Done.
+ (options & autofill::ShowPasswordSuggestionsOptions::SHOW_ALL);
+ bool is_password_field =
+ (options & autofill::ShowPasswordSuggestionsOptions::IS_PASSWORD_FIELD);
+ base::string16 title;
Evan Stade 2014/12/03 17:54:50 s/title/password_field_suggestions_title
jww 2014/12/04 18:59:56 Done.
+ if (is_password_field) {
+ title = l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_PASSWORD_FIELD_SUGGESTIONS_TITLE);
+ }
+
std::vector<base::string16> suggestions;
std::vector<base::string16> realms;
LoginToPasswordInfoMap::const_iterator fill_data_it =
@@ -133,6 +145,12 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
std::vector<base::string16> empty(suggestions.size());
std::vector<int> password_ids(suggestions.size(),
autofill::POPUP_ITEM_ID_PASSWORD_ENTRY);
+ if (!title.empty()) {
Evan Stade 2014/12/03 17:54:50 you can combine this with the is_password_field co
+ suggestions.insert(suggestions.begin(), title);
+ realms.insert(realms.begin(), base::string16());
+ empty.insert(empty.begin(), base::string16());
+ password_ids.insert(password_ids.begin(), autofill::POPUP_ITEM_ID_TITLE);
+ }
autofill_client_->ShowAutofillPopup(bounds,
text_direction,
suggestions,

Powered by Google App Engine
This is Rietveld 408576698