diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-05 04:20:31 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-05 04:20:31 +0000 |
commit | 5ae8ce17da13ea2755858d834c4e7e890534a069 (patch) | |
tree | d9930f99f8a6a182e673212df599501aba3b2ccb /webkit/glue/editor_client_impl.h | |
parent | ffa2b24e61f3d5bb0696014b2f0acb1399bd31cc (diff) | |
download | chromium_src-5ae8ce17da13ea2755858d834c4e7e890534a069.zip chromium_src-5ae8ce17da13ea2755858d834c4e7e890534a069.tar.gz chromium_src-5ae8ce17da13ea2755858d834c4e7e890534a069.tar.bz2 |
Some cleanup to various WebCore client implementations.
Replaced usage of MessageLoop in EditorClientImpl with WebCore::Timer.
Changed the clients to be instance variables of WebViewImpl instead of
being separately heap allocated. This cleaned up some of the lifetime
issues.
R=dglazkov
Review URL: http://codereview.chromium.org/198030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.h')
-rw-r--r-- | webkit/glue/editor_client_impl.h | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/webkit/glue/editor_client_impl.h b/webkit/glue/editor_client_impl.h index 1ca7ce1..c2712a9 100644 --- a/webkit/glue/editor_client_impl.h +++ b/webkit/glue/editor_client_impl.h @@ -5,12 +5,10 @@ #ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ #define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ -#include <deque> - #include "DOMWindow.h" #include "EditorClient.h" - -#include "base/task.h" +#include "Timer.h" +#include <wtf/Deque.h> namespace WebCore { class Frame; @@ -29,8 +27,6 @@ class EditorClientImpl : public WebCore::EditorClient { EditorClientImpl(WebViewImpl* web_view, WebKit::WebEditingClient* editing_client); - void DropEditingClient() { editing_client_ = NULL; } - virtual ~EditorClientImpl(); virtual void pageDestroyed(); @@ -142,26 +138,15 @@ class EditorClientImpl : public WebCore::EditorClient { bool autofill_on_empty_value, bool requires_caret_at_end); - // This method is invoked later by Autofill() as when Autofill() is invoked - // (from one of the EditorClient callback) the carret position is not - // reflecting the last text change yet and we need it to decide whether or not - // to show the autofill popup. - void DoAutofill(WebCore::HTMLInputElement* input_element, - bool form_autofill_only, - bool autofill_on_empty_value, - bool requires_caret_at_end, - bool backspace); - - protected: - WebViewImpl* web_view_; - WebKit::WebEditingClient* editing_client_; - bool in_redo_; + private: + // Called to process the autofill described by autofill_args_. + // This method is invoked asynchronously if the caret position is not + // reflecting the last text change yet, and we need it to decide whether or + // not to show the autofill popup. + void DoAutofill(WebCore::Timer<EditorClientImpl>*); - typedef std::deque<WTF::RefPtr<WebCore::EditCommand> > EditCommandStack; - EditCommandStack undo_stack_; - EditCommandStack redo_stack_; + void CancelPendingAutofill(); - private: // Returns whether or not the focused control needs spell-checking. // Currently, this function just retrieves the focused node and determines // whether or not it is a <textarea> element or an element whose @@ -171,6 +156,14 @@ class EditorClientImpl : public WebCore::EditorClient { // for text fields and create a flag to over-write the default behavior. bool ShouldSpellcheckByDefault(); + WebViewImpl* web_view_; + WebKit::WebEditingClient* editing_client_; + bool in_redo_; + + typedef Deque< RefPtr<WebCore::EditCommand> > EditCommandStack; + EditCommandStack undo_stack_; + EditCommandStack redo_stack_; + // Whether the last entered key was a backspace. bool backspace_or_delete_pressed_; @@ -183,8 +176,17 @@ class EditorClientImpl : public WebCore::EditorClient { }; int spell_check_this_field_status_; - // The method factory used to post autofill related tasks. - ScopedRunnableMethodFactory<EditorClientImpl> autofill_factory_; + // Used to delay autofill processing. + WebCore::Timer<EditorClientImpl> autofill_timer_; + + struct AutofillArgs { + RefPtr<WebCore::HTMLInputElement> input_element; + bool autofill_form_only; + bool autofill_on_empty_value; + bool require_caret_at_end; + bool backspace_or_delete_pressed; + }; + OwnPtr<AutofillArgs> autofill_args_; }; #endif // WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__ |