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

Side by Side Diff: ui/events/devices/mojo/touchscreen_device_struct_traits.h

Issue 1992443002: Add Mojo IPC based input-device service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_ddm
Patch Set: Fixes for comments. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef UI_EVENTS_DEVICES_MOJO_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
6 #define UI_EVENTS_DEVICES_MOJO_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "base/strings/string_piece.h"
11 #include "ui/events/devices/mojo/input_devices.mojom.h"
12 #include "ui/events/devices/touchscreen_device.h"
13 #include "ui/gfx/geometry/size.h"
14
15 namespace mojo {
16
17 template <>
18 struct StructTraits<ui::mojom::TouchscreenDevice, ui::TouchscreenDevice> {
19 static const ui::InputDevice& input_device(
20 const ui::TouchscreenDevice& device) {
21 return static_cast<const ui::InputDevice&>(device);
22 }
23
24 static gfx::Size size(const ui::TouchscreenDevice& device) {
sadrul 2016/06/08 16:31:09 const &
kylechar 2016/06/08 18:13:16 Done.
25 return device.size;
26 }
27
28 static int32_t touch_points(const ui::TouchscreenDevice& device) {
29 return device.touch_points;
30 }
31
32 static bool Read(ui::mojom::TouchscreenDeviceDataView data,
33 ui::TouchscreenDevice* out) {
34 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out)))
35 return false;
36
37 if (!data.ReadSize(&out->size))
38 return false;
39
40 out->touch_points = data.touch_points();
41
42 return true;
43 }
44 };
45
sadrul 2016/06/08 16:31:09 This could maybe go in the input_device_struct_tra
kylechar 2016/06/08 18:13:16 Sure, done.
46 } // namespace mojo
47
48 #endif // UI_EVENTS_DEVICES_MOJO_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698