diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 23:44:28 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 23:44:28 +0000 |
commit | f1e616dfd58e18db080b5762155b09b61a539763 (patch) | |
tree | 0f446c462cbdca9a620dbd6fbee631839ff2a1bb /webkit/glue | |
parent | 77a7db91faaa47639ae3f41257eb1901999b93dc (diff) | |
download | chromium_src-f1e616dfd58e18db080b5762155b09b61a539763.zip chromium_src-f1e616dfd58e18db080b5762155b09b61a539763.tar.gz chromium_src-f1e616dfd58e18db080b5762155b09b61a539763.tar.bz2 |
The autofilling of passwords when the URL for visited page and the page the password was stored are different was broken.
This happened as part as some refactoring done for the form autofill last year.
BUG=12675
TEST=See bug.
Review URL: http://codereview.chromium.org/113853
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 22 | ||||
-rw-r--r-- | webkit/glue/editor_client_impl.h | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index 7216e4f..a4b8380 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -677,7 +677,7 @@ void EditorClientImpl::handleInputMethodKeydown(WebCore::KeyboardEvent* keyEvent void EditorClientImpl::textFieldDidBeginEditing(WebCore::Element*) { } -void EditorClientImpl::textFieldDidEndEditing(WebCore::Element*) { +void EditorClientImpl::textFieldDidEndEditing(WebCore::Element* element) { // Notification that focus was lost. Be careful with this, it's also sent // when the page is being closed. @@ -686,6 +686,26 @@ void EditorClientImpl::textFieldDidEndEditing(WebCore::Element*) { // Hide any showing popup. web_view_->HideAutoCompletePopup(); + + // Notify any password-listener of the focus change. + WebCore::HTMLInputElement* input_element = + webkit_glue::ElementToHTMLInputElement(element); + if (!input_element) + return; + + WebFrameImpl* webframe = + WebFrameImpl::FromFrame(input_element->document()->frame()); + if (webframe->GetView() && !webframe->GetView()->GetDelegate()) + return; // The page is getting closed, don't fill the password. + + webkit_glue::PasswordAutocompleteListener* listener = + webframe->GetPasswordListener(input_element); + if (!listener) + return; + + std::wstring value = + webkit_glue::StringToStdWString(input_element->value()); + listener->OnBlur(input_element, value); } void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) { diff --git a/webkit/glue/editor_client_impl.h b/webkit/glue/editor_client_impl.h index 0778b48..4bacad2a 100644 --- a/webkit/glue/editor_client_impl.h +++ b/webkit/glue/editor_client_impl.h @@ -77,7 +77,7 @@ class EditorClientImpl : public WebCore::EditorClient { virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*); virtual void textFieldDidBeginEditing(WebCore::Element*); - virtual void textFieldDidEndEditing(WebCore::Element*); + virtual void textFieldDidEndEditing(WebCore::Element* element); virtual void textDidChangeInTextField(WebCore::Element*); virtual bool doTextFieldCommandFromEvent(WebCore::Element*,WebCore::KeyboardEvent*); virtual void textWillBeDeletedInTextField(WebCore::Element*); |