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

Side by Side Diff: components/mus/input_devices/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: Rebase/update. 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 COMPONENTS_MUS_INPUT_DEVICES_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
6 #define COMPONENTS_MUS_INPUT_DEVICES_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "base/strings/string_piece.h"
11 #include "components/mus/public/interfaces/input_devices/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<input_device::mojom::TouchscreenDevice,
19 ui::TouchscreenDevice> {
20 static const ui::InputDevice& input_device(
21 const ui::TouchscreenDevice& device) {
22 return static_cast<const ui::InputDevice&>(device);
23 }
24
25 static gfx::Size size(const ui::TouchscreenDevice& device) {
26 return device.size;
27 }
28
29 static int32_t touch_points(const ui::TouchscreenDevice& device) {
30 return device.touch_points;
31 }
32
33 static bool Read(input_device::mojom::TouchscreenDeviceDataView data,
34 ui::TouchscreenDevice* out) {
35 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out)))
36 return false;
37
38 if (!data.ReadSize(&out->size))
39 return false;
40
41 out->touch_points = data.touch_points();
42
43 return true;
44 }
45 };
46
47 } // namespace mojo
48
49 #endif // COMPONENTS_MUS_INPUT_DEVICES_TOUCHSCREEN_DEVICE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698