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 df8056242e3eed16495550ae170eeafec6200860..7a1262b7579cc1de2a1edd45baf8189b3b70691f 100644 |
| --- a/components/autofill/content/renderer/password_autofill_agent.cc |
| +++ b/components/autofill/content/renderer/password_autofill_agent.cc |
| @@ -449,6 +449,8 @@ bool PasswordAutofillAgent::OnMessageReceived(const IPC::Message& message) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(PasswordAutofillAgent, message) |
| IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordForm, OnFillPasswordForm) |
| + IPC_MESSAGE_HANDLER(AutofillMsg_RemovePasswordSuggestion, |
| + OnRemovePasswordSuggestion) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| @@ -645,6 +647,27 @@ void PasswordAutofillAgent::OnFillPasswordForm( |
| form_data)); |
| } |
| } |
| +void PasswordAutofillAgent::OnRemovePasswordSuggestion( |
| + const PasswordForm& password_form) { |
| + |
| + std::vector<PasswordForm> updated_password_forms; |
| + |
| + LoginToPasswordInfoMap::iterator iter; |
| + for (iter = login_to_password_info_.begin(); |
| + iter != login_to_password_info_.end();) { |
| + scoped_ptr<PasswordForm> new_password_form( |
| + CreatePasswordForm(iter->second.password_field.form())); |
| + if (new_password_form.get()) { |
|
vabr (Chromium)
2014/04/01 16:56:08
Should we also test if new_password_form is simila
rchtara
2014/04/03 08:44:50
I'm sure but i think it better to leave that to th
|
| + login_to_password_info_.erase(iter++); |
| + updated_password_forms.push_back(*new_password_form); |
| + } else { |
| + ++iter; |
| + } |
| + } |
| + |
| + Send(new AutofillHostMsg_RemovePasswordSuggestion( |
| + routing_id(), password_form, updated_password_forms)); |
| +} |
| //////////////////////////////////////////////////////////////////////////////// |
| // PasswordAutofillAgent, private: |
| @@ -702,6 +725,10 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
| FindFormAndFieldForInputElement( |
| user_input, &form, &field, REQUIRE_NONE); |
| + scoped_ptr<PasswordForm> password_form = |
| + CreatePasswordForm(user_input.form()); |
|
vabr (Chromium)
2014/04/01 17:14:35
To record, what we just spoke about: instead of cr
rchtara
2014/04/03 08:44:50
Done.
|
| + DCHECK(password_form); |
| + |
| blink::WebInputElement selected_element = user_input; |
| gfx::Rect bounding_box(selected_element.boundsInViewportSpace()); |
| @@ -712,6 +739,7 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
| bounding_box.height() * scale); |
| Send(new AutofillHostMsg_ShowPasswordSuggestions(routing_id(), |
| field, |
| + *password_form, |
| bounding_box_scaled, |
| suggestions, |
| realms)); |