Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaning the code Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d59aeefe9761283cca12ef84d1080f9a578a23ac..ea9b56a471774a728fa1eae13a9f0c5013de228d 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -381,6 +381,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;
@@ -555,6 +557,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()) {
+ 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:
@@ -612,6 +635,10 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
FindFormAndFieldForInputElement(
user_input, &form, &field, REQUIRE_NONE);
+ scoped_ptr<PasswordForm> password_form =
+ CreatePasswordForm(user_input.form());
+ DCHECK(password_form);
+
blink::WebInputElement selected_element = user_input;
gfx::Rect bounding_box(selected_element.boundsInViewportSpace());
@@ -622,6 +649,7 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
bounding_box.height() * scale);
Send(new AutofillHostMsg_ShowPasswordSuggestions(routing_id(),
field,
+ *password_form,
bounding_box_scaled,
suggestions,
realms));

Powered by Google App Engine
This is Rietveld 408576698