OLD | NEW |
1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
3 | 3 |
4 library native_viewport_event_dispatcher_mojom; | 4 library native_viewport_event_dispatcher_mojom; |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
9 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo
m; | 9 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo
m; |
10 | 10 |
11 | 11 |
12 | 12 |
13 class _NativeViewportEventDispatcherOnEventParams extends bindings.Struct { | 13 class _NativeViewportEventDispatcherOnEventParams extends bindings.Struct { |
14 static const List<bindings.StructDataHeader> kVersions = const [ | 14 static const List<bindings.StructDataHeader> kVersions = const [ |
15 const bindings.StructDataHeader(16, 0) | 15 const bindings.StructDataHeader(16, 0) |
16 ]; | 16 ]; |
17 input_events_mojom.Event event = null; | 17 input_events_mojom.Event event = null; |
18 | 18 |
19 _NativeViewportEventDispatcherOnEventParams() : super(kVersions.last.size); | 19 _NativeViewportEventDispatcherOnEventParams() : super(kVersions.last.size); |
20 | 20 |
| 21 _NativeViewportEventDispatcherOnEventParams.init( |
| 22 input_events_mojom.Event this.event |
| 23 ) : super(kVersions.last.size); |
| 24 |
21 static _NativeViewportEventDispatcherOnEventParams deserialize(bindings.Messag
e message) { | 25 static _NativeViewportEventDispatcherOnEventParams deserialize(bindings.Messag
e message) { |
22 var decoder = new bindings.Decoder(message); | 26 var decoder = new bindings.Decoder(message); |
23 var result = decode(decoder); | 27 var result = decode(decoder); |
24 if (decoder.excessHandles != null) { | 28 if (decoder.excessHandles != null) { |
25 decoder.excessHandles.forEach((h) => h.close()); | 29 decoder.excessHandles.forEach((h) => h.close()); |
26 } | 30 } |
27 return result; | 31 return result; |
28 } | 32 } |
29 | 33 |
30 static _NativeViewportEventDispatcherOnEventParams decode(bindings.Decoder dec
oder0) { | 34 static _NativeViewportEventDispatcherOnEventParams decode(bindings.Decoder dec
oder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 87 } |
84 | 88 |
85 | 89 |
86 class NativeViewportEventDispatcherOnEventResponseParams extends bindings.Struct
{ | 90 class NativeViewportEventDispatcherOnEventResponseParams extends bindings.Struct
{ |
87 static const List<bindings.StructDataHeader> kVersions = const [ | 91 static const List<bindings.StructDataHeader> kVersions = const [ |
88 const bindings.StructDataHeader(8, 0) | 92 const bindings.StructDataHeader(8, 0) |
89 ]; | 93 ]; |
90 | 94 |
91 NativeViewportEventDispatcherOnEventResponseParams() : super(kVersions.last.si
ze); | 95 NativeViewportEventDispatcherOnEventResponseParams() : super(kVersions.last.si
ze); |
92 | 96 |
| 97 NativeViewportEventDispatcherOnEventResponseParams.init( |
| 98 ) : super(kVersions.last.size); |
| 99 |
93 static NativeViewportEventDispatcherOnEventResponseParams deserialize(bindings
.Message message) { | 100 static NativeViewportEventDispatcherOnEventResponseParams deserialize(bindings
.Message message) { |
94 var decoder = new bindings.Decoder(message); | 101 var decoder = new bindings.Decoder(message); |
95 var result = decode(decoder); | 102 var result = decode(decoder); |
96 if (decoder.excessHandles != null) { | 103 if (decoder.excessHandles != null) { |
97 decoder.excessHandles.forEach((h) => h.close()); | 104 decoder.excessHandles.forEach((h) => h.close()); |
98 } | 105 } |
99 return result; | 106 return result; |
100 } | 107 } |
101 | 108 |
102 static NativeViewportEventDispatcherOnEventResponseParams decode(bindings.Deco
der decoder0) { | 109 static NativeViewportEventDispatcherOnEventResponseParams decode(bindings.Deco
der decoder0) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 143 |
137 Map toJson() { | 144 Map toJson() { |
138 Map map = new Map(); | 145 Map map = new Map(); |
139 return map; | 146 return map; |
140 } | 147 } |
141 } | 148 } |
142 | 149 |
143 const int _nativeViewportEventDispatcherMethodOnEventName = 0; | 150 const int _nativeViewportEventDispatcherMethodOnEventName = 0; |
144 | 151 |
145 class _NativeViewportEventDispatcherServiceDescription implements service_descri
ber.ServiceDescription { | 152 class _NativeViewportEventDispatcherServiceDescription implements service_descri
ber.ServiceDescription { |
146 dynamic getTopLevelInterface([Function responseFactory]) => | 153 void getTopLevelInterface(Function responder) { |
147 responseFactory(null); | 154 responder(null); |
| 155 } |
148 | 156 |
149 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 157 void getTypeDefinition(String typeKey, Function responder) { |
150 responseFactory(null); | 158 responder(null); |
| 159 } |
151 | 160 |
152 dynamic getAllTypeDefinitions([Function responseFactory]) => | 161 void getAllTypeDefinitions(Function responder) { |
153 responseFactory(null); | 162 responder(null); |
| 163 } |
154 } | 164 } |
155 | 165 |
156 abstract class NativeViewportEventDispatcher { | 166 abstract class NativeViewportEventDispatcher { |
157 static const String serviceName = null; | 167 static const String serviceName = null; |
158 | 168 |
159 static service_describer.ServiceDescription _cachedServiceDescription; | 169 static service_describer.ServiceDescription _cachedServiceDescription; |
160 static service_describer.ServiceDescription get serviceDescription { | 170 static service_describer.ServiceDescription get serviceDescription { |
161 if (_cachedServiceDescription == null) { | 171 if (_cachedServiceDescription == null) { |
162 _cachedServiceDescription = new _NativeViewportEventDispatcherServiceDescr
iption(); | 172 _cachedServiceDescription = new _NativeViewportEventDispatcherServiceDescr
iption(); |
163 } | 173 } |
164 return _cachedServiceDescription; | 174 return _cachedServiceDescription; |
165 } | 175 } |
166 | 176 |
167 static NativeViewportEventDispatcherProxy connectToService( | 177 static NativeViewportEventDispatcherProxy connectToService( |
168 bindings.ServiceConnector s, String url, [String serviceName]) { | 178 bindings.ServiceConnector s, String url, [String serviceName]) { |
169 NativeViewportEventDispatcherProxy p = new NativeViewportEventDispatcherProx
y.unbound(); | 179 NativeViewportEventDispatcherProxy p = new NativeViewportEventDispatcherProx
y.unbound(); |
170 String name = serviceName ?? NativeViewportEventDispatcher.serviceName; | 180 String name = serviceName ?? NativeViewportEventDispatcher.serviceName; |
171 if ((name == null) || name.isEmpty) { | 181 if ((name == null) || name.isEmpty) { |
172 throw new core.MojoApiError( | 182 throw new core.MojoApiError( |
173 "If an interface has no ServiceName, then one must be provided."); | 183 "If an interface has no ServiceName, then one must be provided."); |
174 } | 184 } |
175 s.connectToService(url, p, name); | 185 s.connectToService(url, p, name); |
176 return p; | 186 return p; |
177 } | 187 } |
178 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul
l]); | 188 void onEvent(input_events_mojom.Event event,void callback()); |
179 } | 189 } |
180 | 190 |
181 abstract class NativeViewportEventDispatcherInterface | 191 abstract class NativeViewportEventDispatcherInterface |
182 implements bindings.MojoInterface<NativeViewportEventDispatcher>, | 192 implements bindings.MojoInterface<NativeViewportEventDispatcher>, |
183 NativeViewportEventDispatcher { | 193 NativeViewportEventDispatcher { |
184 factory NativeViewportEventDispatcherInterface([NativeViewportEventDispatcher
impl]) => | 194 factory NativeViewportEventDispatcherInterface([NativeViewportEventDispatcher
impl]) => |
185 new NativeViewportEventDispatcherStub.unbound(impl); | 195 new NativeViewportEventDispatcherStub.unbound(impl); |
186 | 196 |
187 factory NativeViewportEventDispatcherInterface.fromEndpoint( | 197 factory NativeViewportEventDispatcherInterface.fromEndpoint( |
188 core.MojoMessagePipeEndpoint endpoint, | 198 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
218 | 228 |
219 void handleResponse(bindings.ServiceMessage message) { | 229 void handleResponse(bindings.ServiceMessage message) { |
220 switch (message.header.type) { | 230 switch (message.header.type) { |
221 case _nativeViewportEventDispatcherMethodOnEventName: | 231 case _nativeViewportEventDispatcherMethodOnEventName: |
222 var r = NativeViewportEventDispatcherOnEventResponseParams.deserialize( | 232 var r = NativeViewportEventDispatcherOnEventResponseParams.deserialize( |
223 message.payload); | 233 message.payload); |
224 if (!message.header.hasRequestId) { | 234 if (!message.header.hasRequestId) { |
225 proxyError("Expected a message with a valid request Id."); | 235 proxyError("Expected a message with a valid request Id."); |
226 return; | 236 return; |
227 } | 237 } |
228 Completer c = completerMap[message.header.requestId]; | 238 Function callback = callbackMap[message.header.requestId]; |
229 if (c == null) { | 239 if (callback == null) { |
230 proxyError( | 240 proxyError( |
231 "Message had unknown request Id: ${message.header.requestId}"); | 241 "Message had unknown request Id: ${message.header.requestId}"); |
232 return; | 242 return; |
233 } | 243 } |
234 completerMap.remove(message.header.requestId); | 244 callbackMap.remove(message.header.requestId); |
235 if (c.isCompleted) { | 245 callback(); |
236 proxyError("Response completer already completed"); | |
237 return; | |
238 } | |
239 c.complete(r); | |
240 break; | 246 break; |
241 default: | 247 default: |
242 proxyError("Unexpected message type: ${message.header.type}"); | 248 proxyError("Unexpected message type: ${message.header.type}"); |
243 close(immediate: true); | 249 close(immediate: true); |
244 break; | 250 break; |
245 } | 251 } |
246 } | 252 } |
247 | 253 |
248 @override | 254 @override |
249 String toString() { | 255 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
274 return newMockedProxy; | 280 return newMockedProxy; |
275 } | 281 } |
276 | 282 |
277 static NativeViewportEventDispatcherProxy newFromEndpoint( | 283 static NativeViewportEventDispatcherProxy newFromEndpoint( |
278 core.MojoMessagePipeEndpoint endpoint) { | 284 core.MojoMessagePipeEndpoint endpoint) { |
279 assert(endpoint.setDescription("For NativeViewportEventDispatcherProxy")); | 285 assert(endpoint.setDescription("For NativeViewportEventDispatcherProxy")); |
280 return new NativeViewportEventDispatcherProxy.fromEndpoint(endpoint); | 286 return new NativeViewportEventDispatcherProxy.fromEndpoint(endpoint); |
281 } | 287 } |
282 | 288 |
283 | 289 |
284 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul
l]) { | 290 void onEvent(input_events_mojom.Event event,void callback()) { |
285 if (impl != null) { | 291 if (impl != null) { |
286 return new Future(() => impl.onEvent(event,_NativeViewportEventDispatcherS
tubControl._nativeViewportEventDispatcherOnEventResponseParamsFactory)); | 292 impl.onEvent(event,callback); |
| 293 return; |
287 } | 294 } |
288 var params = new _NativeViewportEventDispatcherOnEventParams(); | 295 var params = new _NativeViewportEventDispatcherOnEventParams(); |
289 params.event = event; | 296 params.event = event; |
290 return ctrl.sendMessageWithRequestId( | 297 ctrl.sendMessageWithRequestId( |
291 params, | 298 params, |
292 _nativeViewportEventDispatcherMethodOnEventName, | 299 _nativeViewportEventDispatcherMethodOnEventName, |
293 -1, | 300 -1, |
294 bindings.MessageHeader.kMessageExpectsResponse); | 301 bindings.MessageHeader.kMessageExpectsResponse, |
| 302 callback); |
295 } | 303 } |
296 } | 304 } |
297 | 305 |
298 class _NativeViewportEventDispatcherStubControl | 306 class _NativeViewportEventDispatcherStubControl |
299 extends bindings.StubMessageHandler | 307 extends bindings.StubMessageHandler |
300 implements bindings.StubControl<NativeViewportEventDispatcher> { | 308 implements bindings.StubControl<NativeViewportEventDispatcher> { |
301 NativeViewportEventDispatcher _impl; | 309 NativeViewportEventDispatcher _impl; |
302 | 310 |
303 _NativeViewportEventDispatcherStubControl.fromEndpoint( | 311 _NativeViewportEventDispatcherStubControl.fromEndpoint( |
304 core.MojoMessagePipeEndpoint endpoint, [NativeViewportEventDispatcher impl
]) | 312 core.MojoMessagePipeEndpoint endpoint, [NativeViewportEventDispatcher impl
]) |
305 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 313 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
306 _impl = impl; | 314 _impl = impl; |
307 } | 315 } |
308 | 316 |
309 _NativeViewportEventDispatcherStubControl.fromHandle( | 317 _NativeViewportEventDispatcherStubControl.fromHandle( |
310 core.MojoHandle handle, [NativeViewportEventDispatcher impl]) | 318 core.MojoHandle handle, [NativeViewportEventDispatcher impl]) |
311 : super.fromHandle(handle, autoBegin: impl != null) { | 319 : super.fromHandle(handle, autoBegin: impl != null) { |
312 _impl = impl; | 320 _impl = impl; |
313 } | 321 } |
314 | 322 |
315 _NativeViewportEventDispatcherStubControl.unbound([this._impl]) : super.unboun
d(); | 323 _NativeViewportEventDispatcherStubControl.unbound([this._impl]) : super.unboun
d(); |
316 | 324 |
317 String get serviceName => NativeViewportEventDispatcher.serviceName; | 325 String get serviceName => NativeViewportEventDispatcher.serviceName; |
318 | 326 |
319 | 327 |
320 static NativeViewportEventDispatcherOnEventResponseParams _nativeViewportEvent
DispatcherOnEventResponseParamsFactory() { | 328 Function _nativeViewportEventDispatcherOnEventResponseParamsResponder( |
321 var result = new NativeViewportEventDispatcherOnEventResponseParams(); | 329 int requestId) { |
322 return result; | 330 return () { |
| 331 var result = new NativeViewportEventDispatcherOnEventResponseParams(); |
| 332 sendResponse(buildResponseWithId( |
| 333 result, |
| 334 _nativeViewportEventDispatcherMethodOnEventName, |
| 335 requestId, |
| 336 bindings.MessageHeader.kMessageIsResponse)); |
| 337 }; |
323 } | 338 } |
324 | 339 |
325 dynamic handleMessage(bindings.ServiceMessage message) { | 340 void handleMessage(bindings.ServiceMessage message) { |
326 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 341 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
327 return bindings.ControlMessageHandler.handleMessage(this, | 342 bindings.ControlMessageHandler.handleMessage( |
328 0, | 343 this, 0, message); |
329 message); | 344 return; |
330 } | 345 } |
331 if (_impl == null) { | 346 if (_impl == null) { |
332 throw new core.MojoApiError("$this has no implementation set"); | 347 throw new core.MojoApiError("$this has no implementation set"); |
333 } | 348 } |
334 switch (message.header.type) { | 349 switch (message.header.type) { |
335 case _nativeViewportEventDispatcherMethodOnEventName: | 350 case _nativeViewportEventDispatcherMethodOnEventName: |
336 var params = _NativeViewportEventDispatcherOnEventParams.deserialize( | 351 var params = _NativeViewportEventDispatcherOnEventParams.deserialize( |
337 message.payload); | 352 message.payload); |
338 var response = _impl.onEvent(params.event,_nativeViewportEventDispatcher
OnEventResponseParamsFactory); | 353 _impl.onEvent(params.event, _nativeViewportEventDispatcherOnEventRespons
eParamsResponder(message.header.requestId)); |
339 if (response is Future) { | |
340 return response.then((response) { | |
341 if (response != null) { | |
342 return buildResponseWithId( | |
343 response, | |
344 _nativeViewportEventDispatcherMethodOnEventName, | |
345 message.header.requestId, | |
346 bindings.MessageHeader.kMessageIsResponse); | |
347 } | |
348 }); | |
349 } else if (response != null) { | |
350 return buildResponseWithId( | |
351 response, | |
352 _nativeViewportEventDispatcherMethodOnEventName, | |
353 message.header.requestId, | |
354 bindings.MessageHeader.kMessageIsResponse); | |
355 } | |
356 break; | 354 break; |
357 default: | 355 default: |
358 throw new bindings.MojoCodecError("Unexpected message name"); | 356 throw new bindings.MojoCodecError("Unexpected message name"); |
359 break; | 357 break; |
360 } | 358 } |
361 return null; | |
362 } | 359 } |
363 | 360 |
364 NativeViewportEventDispatcher get impl => _impl; | 361 NativeViewportEventDispatcher get impl => _impl; |
365 set impl(NativeViewportEventDispatcher d) { | 362 set impl(NativeViewportEventDispatcher d) { |
366 if (d == null) { | 363 if (d == null) { |
367 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 364 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
368 } | 365 } |
369 if (isBound && (_impl == null)) { | 366 if (isBound && (_impl == null)) { |
370 beginHandlingEvents(); | 367 beginHandlingEvents(); |
371 } | 368 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 core.MojoHandle handle, [NativeViewportEventDispatcher impl]) | 402 core.MojoHandle handle, [NativeViewportEventDispatcher impl]) |
406 : super(new _NativeViewportEventDispatcherStubControl.fromHandle(handle, i
mpl)); | 403 : super(new _NativeViewportEventDispatcherStubControl.fromHandle(handle, i
mpl)); |
407 | 404 |
408 static NativeViewportEventDispatcherStub newFromEndpoint( | 405 static NativeViewportEventDispatcherStub newFromEndpoint( |
409 core.MojoMessagePipeEndpoint endpoint) { | 406 core.MojoMessagePipeEndpoint endpoint) { |
410 assert(endpoint.setDescription("For NativeViewportEventDispatcherStub")); | 407 assert(endpoint.setDescription("For NativeViewportEventDispatcherStub")); |
411 return new NativeViewportEventDispatcherStub.fromEndpoint(endpoint); | 408 return new NativeViewportEventDispatcherStub.fromEndpoint(endpoint); |
412 } | 409 } |
413 | 410 |
414 | 411 |
415 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul
l]) { | 412 void onEvent(input_events_mojom.Event event,void callback()) { |
416 return impl.onEvent(event,responseFactory); | 413 return impl.onEvent(event,callback); |
417 } | 414 } |
418 } | 415 } |
419 | 416 |
420 | 417 |
421 | 418 |
OLD | NEW |