OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_RENDERER_EVENT_PACKET_H_ |
| 6 #define CONTENT_RENDERER_GPU_RENDERER_EVENT_PACKET_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "content/common/input/input_event_disposition.h" |
| 15 #include "ipc/ipc_message.h" |
| 16 |
| 17 namespace ui { |
| 18 struct LatencyInfo; |
| 19 } |
| 20 |
| 21 namespace WebKit { |
| 22 class WebInputEvent; |
| 23 } |
| 24 |
| 25 namespace content { |
| 26 |
| 27 class EventPacket; |
| 28 |
| 29 // Utility wrapper class for handling EventPacket dispatch in the renderer. |
| 30 class RendererEventPacket { |
| 31 public: |
| 32 // |packet| is assumed to outlive the constructed RendererEventPacket. |
| 33 RendererEventPacket(const EventPacket* packet, |
| 34 const InputEventDispositions& dispositions); |
| 35 ~RendererEventPacket(); |
| 36 |
| 37 // Provides dispatch of individual |InputEvent| payloads. |
| 38 class Dispatcher { |
| 39 public: |
| 40 virtual ~Dispatcher() {} |
| 41 virtual InputEventDisposition Dispatch(const IPC::Message& message) = 0; |
| 42 virtual InputEventDisposition Dispatch(int routing_id, |
| 43 const WebKit::WebInputEvent* event, |
| 44 const ui::LatencyInfo& latency_info, |
| 45 bool is_keyboard_shortcut) = 0; |
| 46 }; |
| 47 |
| 48 enum DispatchThreadType { |
| 49 THREAD_MAIN, |
| 50 THREAD_IMPL |
| 51 }; |
| 52 |
| 53 // Attempts to dispatch all unprocessed events to |dispatcher| until an |
| 54 // unhandled event prevents further dispatch (e.g., touch event). |
| 55 // Returns the appropriate message for the result, either |
| 56 // * |InputHostMsg_HandleEventPacket_ACK| if dispatch is complete, or |
| 57 // * |InputMsg_HandleEventPacket| if the packet needs forwarding. |
| 58 scoped_ptr<IPC::Message> DispatchWith(Dispatcher* dispatcher, |
| 59 DispatchThreadType thread_type, |
| 60 int routing_id); |
| 61 |
| 62 private: |
| 63 const EventPacket* packet_; |
| 64 InputEventDispositions dispositions_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(RendererEventPacket); |
| 67 }; |
| 68 |
| 69 } // namespace content |
| 70 |
| 71 #endif // CONTENT_RENDERER_GPU_RENDERER_EVENT_PACKET_H_ |
OLD | NEW |