Chromium Code Reviews| Index: components/autofill/content/renderer/password_autofill_agent.cc |
| diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc |
| index f2882c9ff03c8f317012bc560fe544ab5dbe9f69..baa1e8668bf9c489bdbe54ab3ea8215274c3281a 100644 |
| --- a/components/autofill/content/renderer/password_autofill_agent.cc |
| +++ b/components/autofill/content/renderer/password_autofill_agent.cc |
| @@ -1012,6 +1012,7 @@ void PasswordAutofillAgent::DidStartProvisionalLoad( |
| } |
| void PasswordAutofillAgent::OnFillPasswordForm( |
| + int key, |
| const PasswordFormFillData& form_data) { |
| if (usernames_usage_ == NOTHING_TO_AUTOFILL) { |
| if (form_data.other_possible_usernames.size()) |
| @@ -1068,6 +1069,7 @@ void PasswordAutofillAgent::OnFillPasswordForm( |
| password_info.password_field = password_element; |
| login_to_password_info_[username_element] = password_info; |
| password_to_username_[password_element] = username_element; |
| + login_to_password_info_key_[username_element] = key; |
| FormData form; |
| FormFieldData field; |
| @@ -1075,9 +1077,6 @@ void PasswordAutofillAgent::OnFillPasswordForm( |
| FindFormAndFieldForFormControlElement( |
| username_element, &form, &field, REQUIRE_NONE); |
|
Garrett Casto
2014/11/04 07:22:09
This is unneeded, right?
vabr (Chromium)
2014/11/05 11:56:19
Correct, thanks for checking it!
Done.
|
| } |
| - |
| - Send(new AutofillHostMsg_AddPasswordFormMapping( |
| - routing_id(), field, form_data)); |
| } |
| } |
| @@ -1112,13 +1111,18 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
| blink::WebInputElement selected_element = user_input; |
| gfx::Rect bounding_box(selected_element.boundsInViewportSpace()); |
| + LoginToPasswordInfoKeyMap::const_iterator key_it = |
| + login_to_password_info_key_.find(user_input); |
| + DCHECK(key_it != login_to_password_info_key_.end()); |
| + |
| float scale = web_view_->pageScaleFactor(); |
| gfx::RectF bounding_box_scaled(bounding_box.x() * scale, |
| bounding_box.y() * scale, |
| bounding_box.width() * scale, |
| bounding_box.height() * scale); |
| Send(new AutofillHostMsg_ShowPasswordSuggestions( |
| - routing_id(), field, user_input.value(), show_all, bounding_box_scaled)); |
| + routing_id(), key_it->second, field.text_direction, user_input.value(), |
| + show_all, bounding_box_scaled)); |
| bool suggestions_present = false; |
| if (GetSuggestionsStats(fill_data, user_input.value(), show_all, |
| @@ -1170,6 +1174,7 @@ void PasswordAutofillAgent::FrameClosing(const blink::WebFrame* frame) { |
| // There may not be a username field, so get the frame from the password |
| // field. |
| if (iter->second.password_field.document().frame() == frame) { |
| + login_to_password_info_key_.erase(iter->first); |
| password_to_username_.erase(iter->second.password_field); |
| login_to_password_info_.erase(iter++); |
| } else { |