Index: content/renderer/gpu/renderer_event_packet.h |
diff --git a/content/renderer/gpu/renderer_event_packet.h b/content/renderer/gpu/renderer_event_packet.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1bc5c391cfb1cad0977dca04e0002da79126d555 |
--- /dev/null |
+++ b/content/renderer/gpu/renderer_event_packet.h |
@@ -0,0 +1,71 @@ |
+// Copyright (c) 2013 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_GPU_RENDERER_EVENT_PACKET_H_ |
+#define CONTENT_RENDERER_GPU_RENDERER_EVENT_PACKET_H_ |
+ |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/scoped_vector.h" |
+#include "content/common/content_export.h" |
+#include "content/common/input/input_event_disposition.h" |
+#include "ipc/ipc_message.h" |
+ |
+namespace ui { |
+struct LatencyInfo; |
+} |
+ |
+namespace WebKit { |
+class WebInputEvent; |
+} |
+ |
+namespace content { |
+ |
+class EventPacket; |
+ |
+// Utility wrapper class for handling EventPacket dispatch in the renderer. |
+class RendererEventPacket { |
+ public: |
+ // |packet| is assumed to outlive the constructed RendererEventPacket. |
+ RendererEventPacket(const EventPacket* packet, |
+ const InputEventDispositions& dispositions); |
+ ~RendererEventPacket(); |
+ |
+ // Provides dispatch of individual |InputEvent| payloads. |
+ class Dispatcher { |
+ public: |
+ virtual ~Dispatcher() {} |
+ virtual InputEventDisposition Dispatch(const IPC::Message& message) = 0; |
+ virtual InputEventDisposition Dispatch(int routing_id, |
+ const WebKit::WebInputEvent* event, |
+ const ui::LatencyInfo& latency_info, |
+ bool is_keyboard_shortcut) = 0; |
+ }; |
+ |
+ enum DispatchThreadType { |
+ THREAD_MAIN, |
+ THREAD_IMPL |
+ }; |
+ |
+ // Attempts to dispatch all unprocessed events to |dispatcher| until an |
+ // unhandled event prevents further dispatch (e.g., touch event). |
+ // Returns the appropriate message for the result, either |
+ // * |InputHostMsg_HandleEventPacket_ACK| if dispatch is complete, or |
+ // * |InputMsg_HandleEventPacket| if the packet needs forwarding. |
+ scoped_ptr<IPC::Message> DispatchWith(Dispatcher* dispatcher, |
+ DispatchThreadType thread_type, |
+ int routing_id); |
+ |
+ private: |
+ const EventPacket* packet_; |
+ InputEventDispositions dispositions_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RendererEventPacket); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_GPU_RENDERER_EVENT_PACKET_H_ |