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/common/input/web_input_event_traits.h" | 5 #include "content/common/input/web_input_event_traits.h" |
6 | 6 |
7 #include <bitset> | 7 #include <bitset> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "content/common/input_messages.h" |
12 | 13 |
13 using base::StringAppendF; | 14 using base::StringAppendF; |
14 using base::SStringPrintf; | 15 using base::SStringPrintf; |
15 using blink::WebGestureEvent; | 16 using blink::WebGestureEvent; |
16 using blink::WebInputEvent; | 17 using blink::WebInputEvent; |
17 using blink::WebKeyboardEvent; | 18 using blink::WebKeyboardEvent; |
18 using blink::WebMouseEvent; | 19 using blink::WebMouseEvent; |
19 using blink::WebMouseWheelEvent; | 20 using blink::WebMouseWheelEvent; |
20 using blink::WebTouchEvent; | 21 using blink::WebTouchEvent; |
21 using blink::WebTouchPoint; | 22 using blink::WebTouchPoint; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 return true; | 481 return true; |
481 case WebInputEvent::TouchStart: | 482 case WebInputEvent::TouchStart: |
482 case WebInputEvent::TouchMove: | 483 case WebInputEvent::TouchMove: |
483 case WebInputEvent::TouchEnd: | 484 case WebInputEvent::TouchEnd: |
484 return !static_cast<const WebTouchEvent&>(event).cancelable; | 485 return !static_cast<const WebTouchEvent&>(event).cancelable; |
485 default: | 486 default: |
486 return false; | 487 return false; |
487 } | 488 } |
488 } | 489 } |
489 | 490 |
| 491 scoped_ptr<IPC::Message> WebInputEventTraits::CreateAckIfNecessary( |
| 492 const blink::WebInputEvent& event, |
| 493 const content::InputEventAckState ack_state, |
| 494 const ui::LatencyInfo& latency_info, |
| 495 scoped_ptr<DidOverscrollParams> overscroll_params, |
| 496 int routing_id) { |
| 497 scoped_ptr<IPC::Message> response; |
| 498 if (event.type == WebInputEvent::TouchMove) { |
| 499 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); |
| 500 if (!touch.cancelable) { |
| 501 response = scoped_ptr<IPC::Message>( |
| 502 new InputHostMsg_HandleUncancelableTouchMoveEvent_ACK(routing_id)); |
| 503 } |
| 504 } |
| 505 |
| 506 const bool send_ack = !WebInputEventTraits::IgnoresAckDisposition(event); |
| 507 if (send_ack) { |
| 508 DCHECK(!response); |
| 509 InputHostMsg_HandleInputEvent_ACK_Params ack; |
| 510 ack.type = event.type; |
| 511 ack.state = ack_state; |
| 512 ack.latency = latency_info; |
| 513 ack.overscroll = overscroll_params.Pass(); |
| 514 response = scoped_ptr<IPC::Message>( |
| 515 new InputHostMsg_HandleInputEvent_ACK(routing_id, ack)); |
| 516 } |
| 517 return response.Pass(); |
| 518 } |
| 519 |
490 } // namespace content | 520 } // namespace content |
OLD | NEW |