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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 current_view_flags_ = view_flags; | 241 current_view_flags_ = view_flags; |
242 | 242 |
243 // A fixed page scale or mobile viewport should disable the touch ack timeout. | 243 // A fixed page scale or mobile viewport should disable the touch ack timeout. |
244 UpdateTouchAckTimeoutEnabled(); | 244 UpdateTouchAckTimeoutEnabled(); |
245 } | 245 } |
246 | 246 |
247 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { | 247 bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) { |
248 bool handled = true; | 248 bool handled = true; |
249 IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) | 249 IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message) |
250 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) | 250 IPC_MESSAGE_HANDLER(InputHostMsg_HandleInputEvent_ACK, OnInputEventAck) |
| 251 IPC_MESSAGE_HANDLER(InputHostMsg_HandleUncancelableTouchMoveEvent_ACK, |
| 252 OnUncancelableTouchMoveAck) |
251 IPC_MESSAGE_HANDLER(InputHostMsg_DidOverscroll, OnDidOverscroll) | 253 IPC_MESSAGE_HANDLER(InputHostMsg_DidOverscroll, OnDidOverscroll) |
252 IPC_MESSAGE_HANDLER(InputHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) | 254 IPC_MESSAGE_HANDLER(InputHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) |
253 IPC_MESSAGE_HANDLER(InputHostMsg_SelectRange_ACK, OnSelectMessageAck) | 255 IPC_MESSAGE_HANDLER(InputHostMsg_SelectRange_ACK, OnSelectMessageAck) |
254 IPC_MESSAGE_HANDLER(InputHostMsg_MoveRangeSelectionExtent_ACK, | 256 IPC_MESSAGE_HANDLER(InputHostMsg_MoveRangeSelectionExtent_ACK, |
255 OnSelectMessageAck) | 257 OnSelectMessageAck) |
256 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 258 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
257 OnHasTouchEventHandlers) | 259 OnHasTouchEventHandlers) |
258 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, | 260 IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, |
259 OnSetTouchAction) | 261 OnSetTouchAction) |
260 IPC_MESSAGE_UNHANDLED(handled = false) | 262 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (OfferToClient(input_event, latency_info)) | 344 if (OfferToClient(input_event, latency_info)) |
343 return; | 345 return; |
344 | 346 |
345 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); | 347 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); |
346 | 348 |
347 // Touch events should always indicate in the event whether they are | 349 // Touch events should always indicate in the event whether they are |
348 // cancelable (respect ACK disposition) or not. | 350 // cancelable (respect ACK disposition) or not. |
349 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); | 351 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); |
350 if (WebInputEvent::isTouchEventType(input_event.type)) { | 352 if (WebInputEvent::isTouchEventType(input_event.type)) { |
351 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); | 353 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); |
352 DCHECK_NE(ignores_ack, !!touch.cancelable); | 354 DCHECK_NE(ignores_ack, touch.cancelable); |
353 } | 355 } |
354 | 356 |
355 // If we don't care about the ack disposition, send the ack immediately. | 357 // If we don't care about the ack disposition, send the ack immediately. |
356 if (ignores_ack) { | 358 if (ignores_ack) { |
357 ProcessInputEventAck(input_event.type, | 359 ProcessInputEventAck(input_event.type, |
358 INPUT_EVENT_ACK_STATE_IGNORED, | 360 INPUT_EVENT_ACK_STATE_IGNORED, |
359 latency_info, | 361 latency_info, |
360 IGNORING_DISPOSITION); | 362 IGNORING_DISPOSITION); |
361 } | 363 } |
362 } | 364 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 // (ProcessInputEventAck) method, but not on other platforms; using | 430 // (ProcessInputEventAck) method, but not on other platforms; using |
429 // 'void' instead is just as safe (since NotificationSource | 431 // 'void' instead is just as safe (since NotificationSource |
430 // is not actually typesafe) and avoids this error. | 432 // is not actually typesafe) and avoids this error. |
431 int type = static_cast<int>(ack.type); | 433 int type = static_cast<int>(ack.type); |
432 NotificationService::current()->Notify( | 434 NotificationService::current()->Notify( |
433 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, | 435 NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, |
434 Source<void>(this), | 436 Source<void>(this), |
435 Details<int>(&type)); | 437 Details<int>(&type)); |
436 } | 438 } |
437 | 439 |
| 440 void InputRouterImpl::OnUncancelableTouchMoveAck() { |
| 441 touch_event_queue_.ProcessUncancelableTouchMoveAck(); |
| 442 } |
| 443 |
438 void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) { | 444 void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) { |
439 client_->DidOverscroll(params); | 445 client_->DidOverscroll(params); |
440 } | 446 } |
441 | 447 |
442 void InputRouterImpl::OnMsgMoveCaretAck() { | 448 void InputRouterImpl::OnMsgMoveCaretAck() { |
443 move_caret_pending_ = false; | 449 move_caret_pending_ = false; |
444 if (next_move_caret_) | 450 if (next_move_caret_) |
445 SendMoveCaret(next_move_caret_.Pass()); | 451 SendMoveCaret(next_move_caret_.Pass()); |
446 } | 452 } |
447 | 453 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 return !touch_event_queue_.empty() || | 636 return !touch_event_queue_.empty() || |
631 !gesture_event_queue_.empty() || | 637 !gesture_event_queue_.empty() || |
632 !key_queue_.empty() || | 638 !key_queue_.empty() || |
633 mouse_move_pending_ || | 639 mouse_move_pending_ || |
634 mouse_wheel_pending_ || | 640 mouse_wheel_pending_ || |
635 select_message_pending_ || | 641 select_message_pending_ || |
636 move_caret_pending_; | 642 move_caret_pending_; |
637 } | 643 } |
638 | 644 |
639 } // namespace content | 645 } // namespace content |
OLD | NEW |