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 #include "content/browser/renderer_host/input/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 261 |
262 void InputRouterImpl::OnViewUpdated(int view_flags) { | 262 void InputRouterImpl::OnViewUpdated(int view_flags) { |
263 current_view_flags_ = view_flags; | 263 current_view_flags_ = view_flags; |
264 | 264 |
265 // A fixed page scale or mobile viewport should disable the touch ack timeout. | 265 // A fixed page scale or mobile viewport should disable the touch ack timeout. |
266 UpdateTouchAckTimeoutEnabled(); | 266 UpdateTouchAckTimeoutEnabled(); |
267 } | 267 } |
268 | 268 |
269 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { | 269 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
270 bool handled = true; | 270 bool handled = true; |
271 bool message_is_ok = true; | 271 IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) |
272 IPC_BEGIN_MESSAGE_MAP_EX(InputRouterImpl, message, message_is_ok) | |
273 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) | 272 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) |
274 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) | 273 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) |
275 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) | 274 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) |
276 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 275 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
277 OnHasTouchEventHandlers) | 276 OnHasTouchEventHandlers) |
278 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, | 277 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, |
279 OnSetTouchAction) | 278 OnSetTouchAction) |
280 IPC_MESSAGE_UNHANDLED(handled = false) | 279 IPC_MESSAGE_UNHANDLED(handled = false) |
281 IPC_END_MESSAGE_MAP() | 280 IPC_END_MESSAGE_MAP() |
282 | 281 |
283 if (!message_is_ok) | |
284 ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE); | |
285 | |
286 return handled; | 282 return handled; |
287 } | 283 } |
288 | 284 |
289 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 285 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
290 InputEventAckState ack_result) { | 286 InputEventAckState ack_result) { |
291 // Touchstart events sent to the renderer indicate a new touch sequence, but | 287 // Touchstart events sent to the renderer indicate a new touch sequence, but |
292 // in some cases we may filter out sending the touchstart - catch those here. | 288 // in some cases we may filter out sending the touchstart - catch those here. |
293 if (WebTouchEventTraits::IsTouchSequenceStart(event.event) && | 289 if (WebTouchEventTraits::IsTouchSequenceStart(event.event) && |
294 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { | 290 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { |
295 touch_action_filter_.ResetTouchAction(); | 291 touch_action_filter_.ResetTouchAction(); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( | 736 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( |
741 const MouseWheelEventWithLatencyInfo& event, | 737 const MouseWheelEventWithLatencyInfo& event, |
742 bool synthesized_from_pinch) | 738 bool synthesized_from_pinch) |
743 : event(event), synthesized_from_pinch(synthesized_from_pinch) { | 739 : event(event), synthesized_from_pinch(synthesized_from_pinch) { |
744 } | 740 } |
745 | 741 |
746 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { | 742 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { |
747 } | 743 } |
748 | 744 |
749 } // namespace content | 745 } // namespace content |
OLD | NEW |