Chromium Code Reviews| 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 1a45c185369fe414e9cefb2eeb8a86b5299d039f..57b867285079ac1e1bde805a173b8366c81ffd5e 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 { |
| @@ -105,10 +107,11 @@ void PasswordAutofillManager::OnAddPasswordFormMapping( |
| login_to_password_info_[key] = fill_data; |
| } |
| -void PasswordAutofillManager::OnShowPasswordSuggestions( |
| +void PasswordAutofillManager::ShowPasswordSuggestions( |
|
Garrett Casto
2014/11/23 07:49:48
Nit: I would just keep this as one function for no
jww
2014/11/25 02:46:26
Done.
|
| int key, |
| base::i18n::TextDirection text_direction, |
| const base::string16& typed_username, |
| + const base::string16& title, |
| bool show_all, |
| const gfx::RectF& bounds) { |
| std::vector<base::string16> suggestions; |
| @@ -134,6 +137,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()) { |
| + 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, |
| @@ -143,6 +152,25 @@ void PasswordAutofillManager::OnShowPasswordSuggestions( |
| weak_ptr_factory_.GetWeakPtr()); |
| } |
| +void PasswordAutofillManager::OnShowPasswordSuggestions( |
| + int key, |
| + base::i18n::TextDirection text_direction, |
| + const base::string16& typed_username, |
| + int options, |
| + const gfx::RectF& bounds) { |
| + bool show_all = |
| + (options & autofill::ShowPasswordSuggestionsOptions::SHOW_ALL); |
| + bool is_password_field = |
| + (options & autofill::ShowPasswordSuggestionsOptions::IS_PASSWORD_FIELD); |
| + base::string16 title; |
| + if (is_password_field) { |
| + title = l10n_util::GetStringUTF16( |
| + IDS_AUTOFILL_PASSWORD_FIELD_SUGGESTIONS_TITLE); |
| + } |
| + ShowPasswordSuggestions(key, text_direction, typed_username, title, show_all, |
| + bounds); |
| +} |
| + |
| void PasswordAutofillManager::Reset() { |
| login_to_password_info_.clear(); |
| } |