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

Unified Diff: ui/events/mojo/event_struct_traits.h

Issue 1939133002: StructTraits to map mus::mojom::Event to unique_ptr<ui::Event> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback. Created 4 years, 6 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
« no previous file with comments | « ui/events/mojo/event.typemap ('k') | ui/events/mojo/event_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/mojo/event_struct_traits.h
diff --git a/ui/events/mojo/event_struct_traits.h b/ui/events/mojo/event_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..41e641dcce1ee1a0e20367d433be11275962074c
--- /dev/null
+++ b/ui/events/mojo/event_struct_traits.h
@@ -0,0 +1,32 @@
+// Copyright 2016 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.
+
+#ifndef COMPONENTS_MUS_PUBLIC_CPP_EVENT_STRUCT_TRAITS_H_
+#define COMPONENTS_MUS_PUBLIC_CPP_EVENT_STRUCT_TRAITS_H_
+
+#include "components/mus/public/interfaces/input_events.mojom.h"
+
+namespace ui {
+class Event;
+}
+
+namespace mojo {
+
+using EventUniquePtr = std::unique_ptr<ui::Event>;
+
+template <>
+struct StructTraits<mus::mojom::Event, EventUniquePtr> {
+ static int32_t action(const EventUniquePtr& event);
+ static int32_t flags(const EventUniquePtr& event);
+ static int64_t time_stamp(const EventUniquePtr& event);
+ static bool has_key_data(const EventUniquePtr& event);
+ static mus::mojom::KeyDataPtr key_data(const EventUniquePtr& event);
+ static bool has_pointer_data(const EventUniquePtr& event);
+ static mus::mojom::PointerDataPtr pointer_data(const EventUniquePtr& event);
+ static bool Read(mus::mojom::EventDataView r, EventUniquePtr* out);
+};
+
+} // namespace mus
+
+#endif // COMPONENTS_MUS_PUBLIC_CPP_EVENT_STRUCT_TRAITS_H_
« no previous file with comments | « ui/events/mojo/event.typemap ('k') | ui/events/mojo/event_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698