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 91fc888f970f1f9595201e92cb0a40d0b24a11a8..a2fcdaaa6a5fdab5e81704970e2dd49fec8b000e 100644 |
| --- a/components/autofill/content/renderer/password_autofill_agent.cc |
| +++ b/components/autofill/content/renderer/password_autofill_agent.cc |
| @@ -442,6 +442,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; |
| @@ -638,6 +640,31 @@ void PasswordAutofillAgent::OnFillPasswordForm( |
| form_data)); |
| } |
| } |
| +void PasswordAutofillAgent::OnRemovePasswordSuggestion( |
| + const base::string16& username_to_remove) { |
| + scoped_ptr<PasswordForm> password_form = |
| + CreatePasswordForm(current_form_); |
| + DCHECK(password_form); |
|
vabr (Chromium)
2014/04/04 10:51:40
Please check with a debug build of Chrome, that us
rchtara
2014/04/04 16:07:20
I just checked it and it's working
:)
|
| + password_form->username_value = username_to_remove; |
| + |
| + 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()) { |
| + 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: |
| @@ -695,6 +722,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup( |
| FindFormAndFieldForFormControlElement( |
| user_input, &form, &field, REQUIRE_NONE); |
| + current_form_ = user_input.form(); |
| + |
| blink::WebInputElement selected_element = user_input; |
| gfx::Rect bounding_box(selected_element.boundsInViewportSpace()); |