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

Unified Diff: chrome/renderer/autofill/password_autofill_manager.cc

Issue 9600038: Add Password Autofill Manager to New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing up login password clearing Created 8 years, 9 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: chrome/renderer/autofill/password_autofill_manager.cc
diff --git a/chrome/renderer/autofill/password_autofill_manager.cc b/chrome/renderer/autofill/password_autofill_manager.cc
index 65dba44df5f7d4a1758b58f49681c7aabdfacc10..98361265ff250d51e234f441c761e33e61333c37 100644
--- a/chrome/renderer/autofill/password_autofill_manager.cc
+++ b/chrome/renderer/autofill/password_autofill_manager.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "chrome/common/autofill_messages.h"
+#include "chrome/renderer/autofill/form_autofill_util.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
@@ -204,6 +205,7 @@ namespace autofill {
PasswordAutofillManager::PasswordAutofillManager(
content::RenderView* render_view)
: content::RenderViewObserver(render_view),
+ disable_popup_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
}
@@ -332,6 +334,20 @@ bool PasswordAutofillManager::DidClearAutofillSelection(
return FindLoginInfo(node, &input, &password);
}
+void PasswordAutofillManager::HandleKeyDown(const WebKit::WebInputElement& node,
+ int key_code) {
+ LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(node);
+ if (iter == login_to_password_info_.end()) {
+ // The browser code should only send this message when it knows we have a
+ // match.
+ NOTREACHED();
+ return;
+ }
+
+ iter->second.backspace_pressed_last =
+ (key_code == ui::VKEY_BACK || key_code == ui::VKEY_DELETE);
Ilya Sherman 2012/03/12 23:46:13 Hmm, I thought we were letting the event bubble na
csharp 2012/03/13 18:31:14 This code was from when I was handling it in the b
+}
+
void PasswordAutofillManager::SendPasswordForms(WebKit::WebFrame* frame,
bool only_visible) {
// Make sure that this security origin is allowed to use password manager.
@@ -410,7 +426,10 @@ bool PasswordAutofillManager::InputElementLostFocus() {
}
void PasswordAutofillManager::OnFillPasswordForm(
- const webkit::forms::PasswordFormFillData& form_data) {
+ const webkit::forms::PasswordFormFillData& form_data,
+ bool disable_popup) {
+ disable_popup_ = disable_popup;
+
FormElementsList forms;
// We own the FormElements* in forms.
FindFormElements(render_view()->GetWebView(), form_data.basic_data, &forms);
@@ -443,6 +462,15 @@ void PasswordAutofillManager::OnFillPasswordForm(
password_info.fill_data = form_data;
password_info.password_field = password_element;
login_to_password_info_[username_element] = password_info;
+
+ webkit::forms::FormData form;
+ webkit::forms::FormField field;
+ FindFormAndFieldForInputElement(
+ username_element, &form, &field, REQUIRE_NONE);
+ Send(new AutofillHostMsg_AddPasswordFormMapping(
+ routing_id(),
+ field,
+ form_data));
}
}
@@ -467,6 +495,9 @@ void PasswordAutofillManager::GetSuggestions(
bool PasswordAutofillManager::ShowSuggestionPopup(
const webkit::forms::PasswordFormFillData& fill_data,
const WebKit::WebInputElement& user_input) {
+ if (disable_popup_)
+ return false;
+
WebKit::WebFrame* frame = user_input.document().frame();
if (!frame)
return false;

Powered by Google App Engine
This is Rietveld 408576698