Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: content/common/input/input_event_utils.cc

Issue 19624005: Add InputEvent and EventPacket types for batched input delivery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/input/input_event_utils.cc
diff --git a/content/common/input/input_event_utils.cc b/content/common/input/input_event_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..429f9361ba96aa093a4be9c45a72e21bbf5080b7
--- /dev/null
+++ b/content/common/input/input_event_utils.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/input/input_event_utils.h"
+
+#include "content/common/input/event_packet.h"
+#include "content/common/input_messages.h"
+#include "ipc/ipc_message.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+
+namespace content {
+
+bool IsWebInputEventMessage(const IPC::Message& message) {
+ return message.type() == InputMsg_HandleInputEvent::ID;
+}
+
+bool CrackWebInputEventMessage(const IPC::Message& message,
+ const WebKit::WebInputEvent** output_event,
+ ui::LatencyInfo* output_latency_info,
+ bool* optional_output_is_keyboard_shortcut) {
+ DCHECK(IsWebInputEventMessage(message));
+ DCHECK(output_event);
+ DCHECK(output_latency_info);
+ bool output_is_keyboard_shortcut;
+ if (!optional_output_is_keyboard_shortcut)
+ optional_output_is_keyboard_shortcut = &output_is_keyboard_shortcut;
+ return InputMsg_HandleInputEvent::Read(&message,
+ output_event,
+ output_latency_info,
+ optional_output_is_keyboard_shortcut);
+}
+
+bool IsEventPacketMessage(const IPC::Message& message) {
+ return message.type() == InputMsg_HandleEventPacket::ID ||
+ message.type() == InputHostMsg_HandleEventPacket_ACK::ID;
+
+}
+
+bool CrackEventPacketMessage(const IPC::Message& message,
+ EventPacket* output_packet) {
+ DCHECK(IsEventPacketMessage(message));
+ DCHECK(output_packet);
+
+ PickleIterator iter(message);
+ return ReadParam(&message, &iter, output_packet);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698