Index: webkit/glue/password_autocomplete_listener.h |
=================================================================== |
--- webkit/glue/password_autocomplete_listener.h (revision 5578) |
+++ webkit/glue/password_autocomplete_listener.h (working copy) |
@@ -8,21 +8,49 @@ |
#ifndef WEBKIT_GLUE_PASSWORD_AUTOCOMPLETE_LISTENER_H_ |
#define WEBKIT_GLUE_PASSWORD_AUTOCOMPLETE_LISTENER_H_ |
+#include "config.h" |
+ |
+#include "base/compiler_specific.h" |
+ |
+MSVC_PUSH_WARNING_LEVEL(0); |
+#include "HTMLInputElement.h" |
+MSVC_POP_WARNING(); |
+ |
#include "base/basictypes.h" |
-#include "webkit/glue/autocomplete_input_listener.h" |
+#include "base/scoped_ptr.h" |
#include "webkit/glue/password_form_dom_manager.h" |
namespace webkit_glue { |
-class PasswordAutocompleteListener : public AutocompleteInputListener { |
+// A proxy interface to a WebCore::HTMLInputElement for inline autocomplete. |
+// The delegate does not own the WebCore element; it only interfaces it. |
+class HTMLInputDelegate { |
public: |
+ explicit HTMLInputDelegate(WebCore::HTMLInputElement* element); |
+ virtual ~HTMLInputDelegate(); |
+ |
+ virtual void SetValue(const std::wstring& value); |
+ virtual void SetSelectionRange(size_t start, size_t end); |
+ virtual void OnFinishedAutocompleting(); |
+ |
+ private: |
+ // The underlying DOM element we're wrapping. We reference the underlying |
+ // HTMLInputElement for its lifetime to ensure it does not get freed by |
+ // WebCore while in use by the delegate instance. |
+ WebCore::HTMLInputElement* element_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HTMLInputDelegate); |
+}; |
+ |
+ |
+class PasswordAutocompleteListener { |
+ public: |
PasswordAutocompleteListener(HTMLInputDelegate* username_delegate, |
HTMLInputDelegate* password_delegate, |
const PasswordFormDomManager::FillData& data); |
virtual ~PasswordAutocompleteListener() { |
} |
- // AutocompleteInputListener implementation. |
virtual void OnBlur(WebCore::HTMLInputElement* element, |
const std::wstring& user_input); |
virtual void OnInlineAutocompleteNeeded(WebCore::HTMLInputElement* element, |
@@ -30,8 +58,8 @@ |
private: |
// Check if the input string resembles a potential matching login |
- // (username/password) and if so, match them up by autocompleting |
- // the edit delegates. |
+ // (username/password) and if so, match them up by autocompleting the edit |
+ // delegates. |
bool TryToMatch(const std::wstring& input, |
const std::wstring& username, |
const std::wstring& password); |