Chromium Code Reviews| 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) { | |
|
tdresser
2015/03/31 14:44:07
Could we end up overwriting response here?
We sho
lanwei
2015/04/01 13:14:21
Done.
| |
| 508 InputHostMsg_HandleInputEvent_ACK_Params ack; | |
| 509 ack.type = event.type; | |
| 510 ack.state = ack_state; | |
| 511 ack.latency = latency_info; | |
| 512 ack.overscroll = overscroll_params.Pass(); | |
| 513 response = scoped_ptr<IPC::Message>( | |
| 514 new InputHostMsg_HandleInputEvent_ACK(routing_id, ack)); | |
| 515 } | |
| 516 return response.Pass(); | |
| 517 } | |
| 518 | |
| 490 } // namespace content | 519 } // namespace content |
| OLD | NEW |