OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/port/browser/event_with_latency_info.h" | 9 #include "content/port/browser/event_with_latency_info.h" |
10 #include "content/port/common/input_event_ack_state.h" | 10 #include "content/port/common/input_event_ack_state.h" |
11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
12 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class InputRouterClient; | 17 class InputRouterClient; |
18 | 18 |
19 // The InputRouter allows the embedder to customize how input events are | 19 // The InputRouter allows the embedder to customize how input events are |
20 // sent to the renderer, and how responses are dispatched to the browser. | 20 // sent to the renderer, and how responses are dispatched to the browser. |
21 // While the router should respect the relative order in which events are | 21 // While the router should respect the relative order in which events are |
22 // received, it is free to customize when those events are dispatched. | 22 // received, it is free to customize when those events are dispatched. |
23 class InputRouter : public IPC::Listener { | 23 class InputRouter : public IPC::Listener { |
24 public: | 24 public: |
25 virtual ~InputRouter() {} | 25 virtual ~InputRouter() {} |
26 | 26 |
| 27 // Should be called only in response to |SetNeedsFlush| requests made via |
| 28 // the |InputRouterClient|. |
| 29 virtual void Flush() = 0; |
| 30 |
27 // Send and take ownership of the the given InputMsg_*. This should be used | 31 // Send and take ownership of the the given InputMsg_*. This should be used |
28 // only for event types not associated with a WebInputEvent. Returns true on | 32 // only for event types not associated with a WebInputEvent. Returns true on |
29 // success and false otherwise. | 33 // success and false otherwise. |
30 virtual bool SendInput(IPC::Message* message) = 0; | 34 virtual bool SendInput(scoped_ptr<IPC::Message> message) = 0; |
31 | 35 |
32 // WebInputEvents | 36 // WebInputEvents |
33 virtual void SendMouseEvent( | 37 virtual void SendMouseEvent( |
34 const MouseEventWithLatencyInfo& mouse_event) = 0; | 38 const MouseEventWithLatencyInfo& mouse_event) = 0; |
35 virtual void SendWheelEvent( | 39 virtual void SendWheelEvent( |
36 const MouseWheelEventWithLatencyInfo& wheel_event) = 0; | 40 const MouseWheelEventWithLatencyInfo& wheel_event) = 0; |
37 virtual void SendKeyboardEvent( | 41 virtual void SendKeyboardEvent( |
38 const NativeWebKeyboardEvent& key_event, | 42 const NativeWebKeyboardEvent& key_event, |
39 const ui::LatencyInfo& latency_info) = 0; | 43 const ui::LatencyInfo& latency_info) = 0; |
40 virtual void SendGestureEvent( | 44 virtual void SendGestureEvent( |
(...skipping 20 matching lines...) Expand all Loading... |
61 virtual bool ShouldForwardGestureEvent( | 65 virtual bool ShouldForwardGestureEvent( |
62 const GestureEventWithLatencyInfo& gesture_event) const = 0; | 66 const GestureEventWithLatencyInfo& gesture_event) const = 0; |
63 | 67 |
64 // Returns |true| if the router has any queued or in-flight gesture events. | 68 // Returns |true| if the router has any queued or in-flight gesture events. |
65 virtual bool HasQueuedGestureEvents() const = 0; | 69 virtual bool HasQueuedGestureEvents() const = 0; |
66 }; | 70 }; |
67 | 71 |
68 } // namespace content | 72 } // namespace content |
69 | 73 |
70 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ | 74 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ |
OLD | NEW |