| 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 2d680b60a622d7d7f1fa8f4f1ed716c236792e61..1a45c185369fe414e9cefb2eeb8a86b5299d039f 100644
|
| --- a/components/password_manager/core/browser/password_autofill_manager.cc
|
| +++ b/components/password_manager/core/browser/password_autofill_manager.cc
|
| @@ -69,12 +69,11 @@ PasswordAutofillManager::PasswordAutofillManager(
|
| PasswordAutofillManager::~PasswordAutofillManager() {
|
| }
|
|
|
| -bool PasswordAutofillManager::FillSuggestion(
|
| - const autofill::FormFieldData& field,
|
| - const base::string16& username) {
|
| +bool PasswordAutofillManager::FillSuggestion(int key,
|
| + const base::string16& username) {
|
| autofill::PasswordFormFillData fill_data;
|
| base::string16 password;
|
| - if (FindLoginInfo(field, &fill_data) &&
|
| + if (FindLoginInfo(key, &fill_data) &&
|
| GetPasswordForUsername(username, fill_data, &password)) {
|
| PasswordManagerDriver* driver = password_manager_client_->GetDriver();
|
| driver->FillSuggestion(username, password);
|
| @@ -84,11 +83,11 @@ bool PasswordAutofillManager::FillSuggestion(
|
| }
|
|
|
| bool PasswordAutofillManager::PreviewSuggestion(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| autofill::PasswordFormFillData fill_data;
|
| base::string16 password;
|
| - if (FindLoginInfo(field, &fill_data) &&
|
| + if (FindLoginInfo(key, &fill_data) &&
|
| GetPasswordForUsername(username, fill_data, &password)) {
|
| PasswordManagerDriver* driver = password_manager_client_->GetDriver();
|
| driver->PreviewSuggestion(username, password);
|
| @@ -98,27 +97,26 @@ bool PasswordAutofillManager::PreviewSuggestion(
|
| }
|
|
|
| void PasswordAutofillManager::OnAddPasswordFormMapping(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const autofill::PasswordFormFillData& fill_data) {
|
| - if (!autofill::IsValidFormFieldData(field) ||
|
| - !autofill::IsValidPasswordFormFillData(fill_data))
|
| + if (!autofill::IsValidPasswordFormFillData(fill_data))
|
| return;
|
|
|
| - login_to_password_info_[field] = fill_data;
|
| + login_to_password_info_[key] = fill_data;
|
| }
|
|
|
| void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| + base::i18n::TextDirection text_direction,
|
| const base::string16& typed_username,
|
| bool show_all,
|
| const gfx::RectF& bounds) {
|
| std::vector<base::string16> suggestions;
|
| std::vector<base::string16> realms;
|
| LoginToPasswordInfoMap::const_iterator fill_data_it =
|
| - login_to_password_info_.find(field);
|
| + login_to_password_info_.find(key);
|
| if (fill_data_it == login_to_password_info_.end()) {
|
| - // TODO(vabr): After https://codereview.chromium.org/686653003/, the only
|
| - // way to get here should be a compromised renderer.
|
| + // Probably a compromised renderer.
|
| NOTREACHED();
|
| return;
|
| }
|
| @@ -126,7 +124,7 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| show_all);
|
| DCHECK_EQ(suggestions.size(), realms.size());
|
|
|
| - form_field_ = field;
|
| + form_data_key_ = key;
|
|
|
| if (suggestions.empty()) {
|
| autofill_client_->HideAutofillPopup();
|
| @@ -137,7 +135,7 @@ void PasswordAutofillManager::OnShowPasswordSuggestions(
|
| std::vector<int> password_ids(suggestions.size(),
|
| autofill::POPUP_ITEM_ID_PASSWORD_ENTRY);
|
| autofill_client_->ShowAutofillPopup(bounds,
|
| - field.text_direction,
|
| + text_direction,
|
| suggestions,
|
| realms,
|
| empty,
|
| @@ -150,15 +148,15 @@ void PasswordAutofillManager::Reset() {
|
| }
|
|
|
| bool PasswordAutofillManager::FillSuggestionForTest(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| - return FillSuggestion(field, username);
|
| + return FillSuggestion(key, username);
|
| }
|
|
|
| bool PasswordAutofillManager::PreviewSuggestionForTest(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| const base::string16& username) {
|
| - return PreviewSuggestion(field, username);
|
| + return PreviewSuggestion(key, username);
|
| }
|
|
|
| void PasswordAutofillManager::OnPopupShown() {
|
| @@ -170,13 +168,13 @@ void PasswordAutofillManager::OnPopupHidden() {
|
| void PasswordAutofillManager::DidSelectSuggestion(const base::string16& value,
|
| int identifier) {
|
| ClearPreviewedForm();
|
| - bool success = PreviewSuggestion(form_field_, value);
|
| + bool success = PreviewSuggestion(form_data_key_, value);
|
| DCHECK(success);
|
| }
|
|
|
| void PasswordAutofillManager::DidAcceptSuggestion(const base::string16& value,
|
| int identifier) {
|
| - bool success = FillSuggestion(form_field_, value);
|
| + bool success = FillSuggestion(form_data_key_, value);
|
| DCHECK(success);
|
| autofill_client_->HideAutofillPopup();
|
| }
|
| @@ -235,9 +233,9 @@ bool PasswordAutofillManager::GetPasswordForUsername(
|
| }
|
|
|
| bool PasswordAutofillManager::FindLoginInfo(
|
| - const autofill::FormFieldData& field,
|
| + int key,
|
| autofill::PasswordFormFillData* found_password) {
|
| - LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field);
|
| + LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(key);
|
| if (iter == login_to_password_info_.end())
|
| return false;
|
|
|
|
|