diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 18:13:17 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 18:13:17 +0000 |
commit | deda7df73efea23971b39173392b29583f5c97d3 (patch) | |
tree | 906a6704a7a7c10d22839782e4d7894095e96b86 | |
parent | d8284ce25292571a359673d0662dd9a1e84bca7a (diff) | |
download | chromium_src-deda7df73efea23971b39173392b29583f5c97d3.zip chromium_src-deda7df73efea23971b39173392b29583f5c97d3.tar.gz chromium_src-deda7df73efea23971b39173392b29583f5c97d3.tar.bz2 |
Autofill popup should close with un-matched names
Fixes a problem with password autocomplete where the popup was not being dismissed in cases where the value of the text field was non-empty but no longer matching a saved name/password combination. This change detects this case and dismisses the popup.
BUG=57213
TEST=Manual test as per bug.
Review URL: http://codereview.chromium.org/3551008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61081 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/webpasswordautocompletelistener_impl.cc | 15 | ||||
-rw-r--r-- | webkit/glue/webpasswordautocompletelistener_impl.h | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/webkit/glue/webpasswordautocompletelistener_impl.cc b/webkit/glue/webpasswordautocompletelistener_impl.cc index fc15af0..0c894fc 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.cc +++ b/webkit/glue/webpasswordautocompletelistener_impl.cc @@ -53,7 +53,7 @@ void WebInputElementDelegate::SetSelectionRange(size_t start, size_t end) { element_.setSelectionRange(start, end); } -void WebInputElementDelegate::RefreshAutofillPopup( +void WebInputElementDelegate::RefreshAutoFillPopup( const std::vector<string16>& suggestions) { WebView* webview = element_.document().frame()->view(); if (webview) { @@ -74,6 +74,13 @@ void WebInputElementDelegate::RefreshAutofillPopup( } } +void WebInputElementDelegate::HideAutoFillPopup() { + WebView* webview = element_.document().frame()->view(); + if (webview) { + webview->hidePopups(); + } +} + WebPasswordAutocompleteListenerImpl::WebPasswordAutocompleteListenerImpl( WebInputElementDelegate* username_delegate, WebInputElementDelegate* password_delegate, @@ -131,8 +138,8 @@ void WebPasswordAutocompleteListenerImpl::performInlineAutocomplete( password_delegate_->SetAutofilled(false); } - if (show_suggestions) - showSuggestionPopup(user_input16); + if (show_suggestions && !showSuggestionPopup(user_input16)) + username_delegate_->HideAutoFillPopup(); if (backspace_or_delete_pressed) return; // Don't inline autocomplete when the user deleted something. @@ -166,7 +173,7 @@ bool WebPasswordAutocompleteListenerImpl::showSuggestionPopup( if (suggestions.empty()) return false; - username_delegate_->RefreshAutofillPopup(suggestions); + username_delegate_->RefreshAutoFillPopup(suggestions); return true; } diff --git a/webkit/glue/webpasswordautocompletelistener_impl.h b/webkit/glue/webpasswordautocompletelistener_impl.h index 8180a47..4a3ed11 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.h +++ b/webkit/glue/webpasswordautocompletelistener_impl.h @@ -33,7 +33,8 @@ class WebInputElementDelegate { virtual bool IsAutofilled() const; virtual void SetAutofilled(bool autofilled); virtual void SetSelectionRange(size_t start, size_t end); - virtual void RefreshAutofillPopup(const std::vector<string16>& suggestions); + virtual void RefreshAutoFillPopup(const std::vector<string16>& suggestions); + virtual void HideAutoFillPopup(); private: // The underlying DOM element we're wrapping. |