OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/common/input/input_event_utils.h" |
| 6 |
| 7 #include "content/common/input/event_packet.h" |
| 8 #include "content/common/input_messages.h" |
| 9 #include "ipc/ipc_message.h" |
| 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 bool IsWebInputEventMessage(const IPC::Message& message) { |
| 15 return message.type() == InputMsg_HandleInputEvent::ID; |
| 16 } |
| 17 |
| 18 bool CrackWebInputEventMessage(const IPC::Message& message, |
| 19 const WebKit::WebInputEvent** output_event, |
| 20 ui::LatencyInfo* output_latency_info, |
| 21 bool* optional_output_is_keyboard_shortcut) { |
| 22 DCHECK(IsWebInputEventMessage(message)); |
| 23 DCHECK(output_event); |
| 24 DCHECK(output_latency_info); |
| 25 bool output_is_keyboard_shortcut; |
| 26 if (!optional_output_is_keyboard_shortcut) |
| 27 optional_output_is_keyboard_shortcut = &output_is_keyboard_shortcut; |
| 28 return InputMsg_HandleInputEvent::Read(&message, |
| 29 output_event, |
| 30 output_latency_info, |
| 31 optional_output_is_keyboard_shortcut); |
| 32 } |
| 33 |
| 34 bool IsEventPacketMessage(const IPC::Message& message) { |
| 35 return message.type() == InputMsg_HandleEventPacket::ID || |
| 36 message.type() == InputHostMsg_HandleEventPacket_ACK::ID; |
| 37 |
| 38 } |
| 39 |
| 40 bool CrackEventPacketMessage(const IPC::Message& message, |
| 41 EventPacket* output_packet) { |
| 42 DCHECK(IsEventPacketMessage(message)); |
| 43 DCHECK(output_packet); |
| 44 |
| 45 PickleIterator iter(message); |
| 46 return ReadParam(&message, &iter, output_packet); |
| 47 } |
| 48 |
| 49 } // namespace content |
OLD | NEW |