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

Side by Side Diff: ui/events/devices/mojo/input_device_struct_traits.cc

Issue 2253293002: Mojo C++ bindings: change the first template parameter of StructTraits and UnionTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@91_extra
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/events/devices/mojo/input_device_struct_traits.h ('k') | ui/events/latency_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/devices/mojo/input_device_struct_traits.h" 5 #include "ui/events/devices/mojo/input_device_struct_traits.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" 8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 26 matching lines...) Expand all
37 case ui::mojom::InputDeviceType::INPUT_DEVICE_UNKNOWN: 37 case ui::mojom::InputDeviceType::INPUT_DEVICE_UNKNOWN:
38 *output = ui::INPUT_DEVICE_UNKNOWN; 38 *output = ui::INPUT_DEVICE_UNKNOWN;
39 break; 39 break;
40 default: 40 default:
41 // Who knows what values might come over the wire, fail if invalid. 41 // Who knows what values might come over the wire, fail if invalid.
42 return false; 42 return false;
43 } 43 }
44 return true; 44 return true;
45 } 45 }
46 46
47 bool StructTraits<ui::mojom::InputDevice, ui::InputDevice>::Read( 47 bool StructTraits<ui::mojom::InputDeviceDataView, ui::InputDevice>::Read(
48 ui::mojom::InputDeviceDataView data, 48 ui::mojom::InputDeviceDataView data,
49 ui::InputDevice* out) { 49 ui::InputDevice* out) {
50 out->id = data.id(); 50 out->id = data.id();
51 51
52 if (!data.ReadType(&out->type)) 52 if (!data.ReadType(&out->type))
53 return false; 53 return false;
54 54
55 if (!data.ReadName(&out->name)) 55 if (!data.ReadName(&out->name))
56 return false; 56 return false;
57 57
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 case ui::mojom::StylusState::INSERTED: 89 case ui::mojom::StylusState::INSERTED:
90 *output = ui::StylusState::INSERTED; 90 *output = ui::StylusState::INSERTED;
91 break; 91 break;
92 default: 92 default:
93 // Who knows what values might come over the wire, fail if invalid. 93 // Who knows what values might come over the wire, fail if invalid.
94 return false; 94 return false;
95 } 95 }
96 return true; 96 return true;
97 } 97 }
98 98
99 bool StructTraits<ui::mojom::TouchscreenDevice, ui::TouchscreenDevice>::Read( 99 bool StructTraits<ui::mojom::TouchscreenDeviceDataView, ui::TouchscreenDevice>::
100 ui::mojom::TouchscreenDeviceDataView data, 100 Read(ui::mojom::TouchscreenDeviceDataView data,
101 ui::TouchscreenDevice* out) { 101 ui::TouchscreenDevice* out) {
102 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out))) 102 if (!data.ReadInputDevice(static_cast<ui::InputDevice*>(out)))
103 return false; 103 return false;
104 104
105 if (!data.ReadSize(&out->size)) 105 if (!data.ReadSize(&out->size))
106 return false; 106 return false;
107 107
108 out->touch_points = data.touch_points(); 108 out->touch_points = data.touch_points();
109 109
110 return true; 110 return true;
111 } 111 }
112 112
113 } // namespace mojo 113 } // namespace mojo
OLDNEW
« no previous file with comments | « ui/events/devices/mojo/input_device_struct_traits.h ('k') | ui/events/latency_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698