public NON_EXPORTED_BASE(TouchEventQueueClient),
public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) {
public:
+ struct CONTENT_EXPORT Config {
+ Config();
+ GestureEventQueue::Config gesture_config;
+ TouchEventQueue::Config touch_config;
+ };
+
InputRouterImpl(IPC::Sender* sender,
InputRouterClient* client,
InputAckHandler* ack_handler,
- int routing_id);
+ int routing_id,
+ const Config& config);
virtual ~InputRouterImpl();
// InputRouter
const ui::LatencyInfo& latency_info,
bool is_keyboard_shortcut);
+ // A data structure that attaches some metadata to a WebMouseWheelEvent
+ // and its latency info.
+ struct QueuedWheelEvent {
+ QueuedWheelEvent();
+ QueuedWheelEvent(const MouseWheelEventWithLatencyInfo& event,
+ bool synthesized_from_pinch);
+ ~QueuedWheelEvent();
+
+ MouseWheelEventWithLatencyInfo event;
+ bool synthesized_from_pinch;
+ };
+
+ // Enqueue or send a mouse wheel event.
+ void SendWheelEvent(const QueuedWheelEvent& wheel_event);
+
+ // Given a Touchpad GesturePinchUpdate event, create and send a synthetic
+ // wheel event for it.
+ void SendSyntheticWheelEventForPinch(
+ const GestureEventWithLatencyInfo& pinch_event);
+
// IPC message handlers
void OnInputEventAck(blink::WebInputEvent::Type event_type,
InputEventAckState ack_result,
void ProcessAckForOverscroll(const blink::WebInputEvent& event,
InputEventAckState ack_result);
- void SimulateTouchGestureWithMouse(
- const MouseEventWithLatencyInfo& mouse_event);
-
// Called when a touch timeout-affecting bit has changed, in turn toggling the
// touch ack timeout feature of the |touch_event_queue_| as appropriate. Input
- // to that determination includes current view properties, the allowed touch
- // action and the command-line configured |touch_ack_timeout_supported_|.
+ // to that determination includes current view properties and the allowed
+ // touch action. Note that this will only affect platforms that have a
+ // non-zero touch timeout configuration.
void UpdateTouchAckTimeoutEnabled();
+ // If a flush has been requested, signals a completed flush to the client if
+ // all events have been dispatched (i.e., |HasPendingEvents()| is false).
+ void SignalFlushedIfNecessary();
+
+ bool HasPendingEvents() const;
+
bool IsInOverscrollGesture() const;
int routing_id() const { return routing_id_; }
// (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent
// and we are waiting for a corresponding ack.
bool mouse_wheel_pending_;
- MouseWheelEventWithLatencyInfo current_wheel_event_;
-
- typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue;
+ QueuedWheelEvent current_wheel_event_;
// (Similar to |next_mouse_move_|.) The next mouse wheel events to send.
// Unlike mouse moves, mouse wheel events received while one is pending are
// high rate; not waiting for the ack results in jankiness, and using the same
// mechanism as for mouse moves (just dropping old events when multiple ones
// would be queued) results in very slow scrolling.
+ typedef std::deque<QueuedWheelEvent> WheelEventQueue;
WheelEventQueue coalesced_mouse_wheel_events_;
- // The time when an input event was sent to the RenderWidget.
- base::TimeTicks input_event_start_time_;
-
- // Queue of keyboard events that we need to track.
- typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
-
// A queue of keyboard events. We can't trust data from the renderer so we
// stuff key events into a queue and pop them out on ACK, feeding our copy
// back to whatever unhandled handler instead of the returned version.
+ typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
KeyQueue key_queue_;
- // Whether touch ack timeout handling has been enabled via the command line.
- bool touch_ack_timeout_supported_;
- base::TimeDelta touch_ack_timeout_delay_;
+ // The time when an input event was sent to the client.
+ base::TimeTicks input_event_start_time_;
// Cached flags from |OnViewUpdated()|, defaults to 0.
int current_view_flags_;
// Defaults to ACK_SOURCE_NONE.
AckSource current_ack_source_;
- scoped_ptr<TouchEventQueue> touch_event_queue_;
- scoped_ptr<GestureEventQueue> gesture_event_queue_;
+ // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call
+ // to the client_ after all events have been dispatched/acked.
+ bool flush_requested_;
+
+ TouchEventQueue touch_event_queue_;
+ GestureEventQueue gesture_event_queue_;
TouchActionFilter touch_action_filter_;
InputEventStreamValidator event_stream_validator_;