Index: content/renderer/android/synchronous_input_event_filter.h |
diff --git a/content/renderer/android/synchronous_input_event_filter.h b/content/renderer/android/synchronous_input_event_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..709912c01a17043068ff7c98e6166f2fcaeee254 |
--- /dev/null |
+++ b/content/renderer/android/synchronous_input_event_filter.h |
@@ -0,0 +1,57 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_INPUT_EVENT_FILTER_H_ |
+#define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_INPUT_EVENT_FILTER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "base/compiler_specific.h" |
+#include "content/public/renderer/android/synchronous_input_event_handler.h" |
+#include "content/renderer/gpu/input_handler_manager_client.h" |
+ |
+namespace WebKit { |
+class WebInputEvent; |
+} |
+ |
+namespace content { |
+ |
+// This class perform synchronous, in-process InputEvent handling. |
+// |
+// The user of this class provides an instance of InputEventFilter::Handler, |
+// which will be passed WebInputEvents on the compositing thread. If the event |
+// goes unhandled, that is reflected in the InputEventAckState; no forwarding |
+// is performed. |
+// |
+// It is up to the user to ensure thread-safety. |
+class SynchronousInputEventFilter : public InputHandlerManagerClient, |
+ public SynchronousInputEventHandler { |
+ public: |
+ typedef base::Callback<void(int /*routing_id*/, |
+ const WebKit::WebInputEvent*)> Handler; |
+ SynchronousInputEventFilter(const Handler& handler); |
+ virtual ~SynchronousInputEventFilter(); |
+ |
+ // SynchronousInputEventHandler implementation. |
+ virtual content::InputEventAckState HandleInputEvent( |
+ int routing_id, |
+ const WebKit::WebInputEvent* input_event) OVERRIDE; |
+ |
+ // InputHandlerManagerClient implementation. |
+ virtual void DidAddInputHandler(int routing_id) OVERRIDE {} |
+ virtual void DidRemoveInputHandler(int routing_id) OVERRIDE {} |
+ virtual void DidHandleInputEvent() OVERRIDE; |
+ virtual void DidNotHandleInputEvent(bool send_to_widget) OVERRIDE; |
+ |
+ private: |
+ Handler handler_; |
+ |
+ // A temporary result reflecting the intermediate callback sequence of |
+ // Did/DidNotHandleInputEvent, initiated by a call to HandleInputEvent. |
+ InputEventAckState event_result_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_INPUT_EVENT_FILTER_H_ |