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 input_mojom; | 4 library input_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 | 9 |
10 | 10 |
11 | 11 |
12 class _InputClientOnBackButtonParams extends bindings.Struct { | 12 class _InputClientOnBackButtonParams extends bindings.Struct { |
13 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
14 const bindings.StructDataHeader(8, 0) | 14 const bindings.StructDataHeader(8, 0) |
15 ]; | 15 ]; |
16 | 16 |
17 _InputClientOnBackButtonParams() : super(kVersions.last.size); | 17 _InputClientOnBackButtonParams() : super(kVersions.last.size); |
18 | 18 |
| 19 _InputClientOnBackButtonParams.init( |
| 20 ) : super(kVersions.last.size); |
| 21 |
19 static _InputClientOnBackButtonParams deserialize(bindings.Message message) { | 22 static _InputClientOnBackButtonParams deserialize(bindings.Message message) { |
20 var decoder = new bindings.Decoder(message); | 23 var decoder = new bindings.Decoder(message); |
21 var result = decode(decoder); | 24 var result = decode(decoder); |
22 if (decoder.excessHandles != null) { | 25 if (decoder.excessHandles != null) { |
23 decoder.excessHandles.forEach((h) => h.close()); | 26 decoder.excessHandles.forEach((h) => h.close()); |
24 } | 27 } |
25 return result; | 28 return result; |
26 } | 29 } |
27 | 30 |
28 static _InputClientOnBackButtonParams decode(bindings.Decoder decoder0) { | 31 static _InputClientOnBackButtonParams decode(bindings.Decoder decoder0) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 70 } |
68 | 71 |
69 | 72 |
70 class InputClientOnBackButtonResponseParams extends bindings.Struct { | 73 class InputClientOnBackButtonResponseParams extends bindings.Struct { |
71 static const List<bindings.StructDataHeader> kVersions = const [ | 74 static const List<bindings.StructDataHeader> kVersions = const [ |
72 const bindings.StructDataHeader(8, 0) | 75 const bindings.StructDataHeader(8, 0) |
73 ]; | 76 ]; |
74 | 77 |
75 InputClientOnBackButtonResponseParams() : super(kVersions.last.size); | 78 InputClientOnBackButtonResponseParams() : super(kVersions.last.size); |
76 | 79 |
| 80 InputClientOnBackButtonResponseParams.init( |
| 81 ) : super(kVersions.last.size); |
| 82 |
77 static InputClientOnBackButtonResponseParams deserialize(bindings.Message mess
age) { | 83 static InputClientOnBackButtonResponseParams deserialize(bindings.Message mess
age) { |
78 var decoder = new bindings.Decoder(message); | 84 var decoder = new bindings.Decoder(message); |
79 var result = decode(decoder); | 85 var result = decode(decoder); |
80 if (decoder.excessHandles != null) { | 86 if (decoder.excessHandles != null) { |
81 decoder.excessHandles.forEach((h) => h.close()); | 87 decoder.excessHandles.forEach((h) => h.close()); |
82 } | 88 } |
83 return result; | 89 return result; |
84 } | 90 } |
85 | 91 |
86 static InputClientOnBackButtonResponseParams decode(bindings.Decoder decoder0)
{ | 92 static InputClientOnBackButtonResponseParams decode(bindings.Decoder decoder0)
{ |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 132 |
127 | 133 |
128 class _InputServiceSetClientParams extends bindings.Struct { | 134 class _InputServiceSetClientParams extends bindings.Struct { |
129 static const List<bindings.StructDataHeader> kVersions = const [ | 135 static const List<bindings.StructDataHeader> kVersions = const [ |
130 const bindings.StructDataHeader(16, 0) | 136 const bindings.StructDataHeader(16, 0) |
131 ]; | 137 ]; |
132 InputClientInterface client = null; | 138 InputClientInterface client = null; |
133 | 139 |
134 _InputServiceSetClientParams() : super(kVersions.last.size); | 140 _InputServiceSetClientParams() : super(kVersions.last.size); |
135 | 141 |
| 142 _InputServiceSetClientParams.init( |
| 143 InputClientInterface this.client |
| 144 ) : super(kVersions.last.size); |
| 145 |
136 static _InputServiceSetClientParams deserialize(bindings.Message message) { | 146 static _InputServiceSetClientParams deserialize(bindings.Message message) { |
137 var decoder = new bindings.Decoder(message); | 147 var decoder = new bindings.Decoder(message); |
138 var result = decode(decoder); | 148 var result = decode(decoder); |
139 if (decoder.excessHandles != null) { | 149 if (decoder.excessHandles != null) { |
140 decoder.excessHandles.forEach((h) => h.close()); | 150 decoder.excessHandles.forEach((h) => h.close()); |
141 } | 151 } |
142 return result; | 152 return result; |
143 } | 153 } |
144 | 154 |
145 static _InputServiceSetClientParams decode(bindings.Decoder decoder0) { | 155 static _InputServiceSetClientParams decode(bindings.Decoder decoder0) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 201 |
192 Map toJson() { | 202 Map toJson() { |
193 throw new bindings.MojoCodecError( | 203 throw new bindings.MojoCodecError( |
194 'Object containing handles cannot be encoded to JSON.'); | 204 'Object containing handles cannot be encoded to JSON.'); |
195 } | 205 } |
196 } | 206 } |
197 | 207 |
198 const int _inputClientMethodOnBackButtonName = 0; | 208 const int _inputClientMethodOnBackButtonName = 0; |
199 | 209 |
200 class _InputClientServiceDescription implements service_describer.ServiceDescrip
tion { | 210 class _InputClientServiceDescription implements service_describer.ServiceDescrip
tion { |
201 dynamic getTopLevelInterface([Function responseFactory]) => | 211 void getTopLevelInterface(Function responder) { |
202 responseFactory(null); | 212 responder(null); |
| 213 } |
203 | 214 |
204 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 215 void getTypeDefinition(String typeKey, Function responder) { |
205 responseFactory(null); | 216 responder(null); |
| 217 } |
206 | 218 |
207 dynamic getAllTypeDefinitions([Function responseFactory]) => | 219 void getAllTypeDefinitions(Function responder) { |
208 responseFactory(null); | 220 responder(null); |
| 221 } |
209 } | 222 } |
210 | 223 |
211 abstract class InputClient { | 224 abstract class InputClient { |
212 static const String serviceName = null; | 225 static const String serviceName = null; |
213 | 226 |
214 static service_describer.ServiceDescription _cachedServiceDescription; | 227 static service_describer.ServiceDescription _cachedServiceDescription; |
215 static service_describer.ServiceDescription get serviceDescription { | 228 static service_describer.ServiceDescription get serviceDescription { |
216 if (_cachedServiceDescription == null) { | 229 if (_cachedServiceDescription == null) { |
217 _cachedServiceDescription = new _InputClientServiceDescription(); | 230 _cachedServiceDescription = new _InputClientServiceDescription(); |
218 } | 231 } |
219 return _cachedServiceDescription; | 232 return _cachedServiceDescription; |
220 } | 233 } |
221 | 234 |
222 static InputClientProxy connectToService( | 235 static InputClientProxy connectToService( |
223 bindings.ServiceConnector s, String url, [String serviceName]) { | 236 bindings.ServiceConnector s, String url, [String serviceName]) { |
224 InputClientProxy p = new InputClientProxy.unbound(); | 237 InputClientProxy p = new InputClientProxy.unbound(); |
225 String name = serviceName ?? InputClient.serviceName; | 238 String name = serviceName ?? InputClient.serviceName; |
226 if ((name == null) || name.isEmpty) { | 239 if ((name == null) || name.isEmpty) { |
227 throw new core.MojoApiError( | 240 throw new core.MojoApiError( |
228 "If an interface has no ServiceName, then one must be provided."); | 241 "If an interface has no ServiceName, then one must be provided."); |
229 } | 242 } |
230 s.connectToService(url, p, name); | 243 s.connectToService(url, p, name); |
231 return p; | 244 return p; |
232 } | 245 } |
233 dynamic onBackButton([Function responseFactory = null]); | 246 void onBackButton(void callback()); |
234 } | 247 } |
235 | 248 |
236 abstract class InputClientInterface | 249 abstract class InputClientInterface |
237 implements bindings.MojoInterface<InputClient>, | 250 implements bindings.MojoInterface<InputClient>, |
238 InputClient { | 251 InputClient { |
239 factory InputClientInterface([InputClient impl]) => | 252 factory InputClientInterface([InputClient impl]) => |
240 new InputClientStub.unbound(impl); | 253 new InputClientStub.unbound(impl); |
241 | 254 |
242 factory InputClientInterface.fromEndpoint( | 255 factory InputClientInterface.fromEndpoint( |
243 core.MojoMessagePipeEndpoint endpoint, | 256 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
273 | 286 |
274 void handleResponse(bindings.ServiceMessage message) { | 287 void handleResponse(bindings.ServiceMessage message) { |
275 switch (message.header.type) { | 288 switch (message.header.type) { |
276 case _inputClientMethodOnBackButtonName: | 289 case _inputClientMethodOnBackButtonName: |
277 var r = InputClientOnBackButtonResponseParams.deserialize( | 290 var r = InputClientOnBackButtonResponseParams.deserialize( |
278 message.payload); | 291 message.payload); |
279 if (!message.header.hasRequestId) { | 292 if (!message.header.hasRequestId) { |
280 proxyError("Expected a message with a valid request Id."); | 293 proxyError("Expected a message with a valid request Id."); |
281 return; | 294 return; |
282 } | 295 } |
283 Completer c = completerMap[message.header.requestId]; | 296 Function callback = callbackMap[message.header.requestId]; |
284 if (c == null) { | 297 if (callback == null) { |
285 proxyError( | 298 proxyError( |
286 "Message had unknown request Id: ${message.header.requestId}"); | 299 "Message had unknown request Id: ${message.header.requestId}"); |
287 return; | 300 return; |
288 } | 301 } |
289 completerMap.remove(message.header.requestId); | 302 callbackMap.remove(message.header.requestId); |
290 if (c.isCompleted) { | 303 callback(); |
291 proxyError("Response completer already completed"); | |
292 return; | |
293 } | |
294 c.complete(r); | |
295 break; | 304 break; |
296 default: | 305 default: |
297 proxyError("Unexpected message type: ${message.header.type}"); | 306 proxyError("Unexpected message type: ${message.header.type}"); |
298 close(immediate: true); | 307 close(immediate: true); |
299 break; | 308 break; |
300 } | 309 } |
301 } | 310 } |
302 | 311 |
303 @override | 312 @override |
304 String toString() { | 313 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
329 return newMockedProxy; | 338 return newMockedProxy; |
330 } | 339 } |
331 | 340 |
332 static InputClientProxy newFromEndpoint( | 341 static InputClientProxy newFromEndpoint( |
333 core.MojoMessagePipeEndpoint endpoint) { | 342 core.MojoMessagePipeEndpoint endpoint) { |
334 assert(endpoint.setDescription("For InputClientProxy")); | 343 assert(endpoint.setDescription("For InputClientProxy")); |
335 return new InputClientProxy.fromEndpoint(endpoint); | 344 return new InputClientProxy.fromEndpoint(endpoint); |
336 } | 345 } |
337 | 346 |
338 | 347 |
339 dynamic onBackButton([Function responseFactory = null]) { | 348 void onBackButton(void callback()) { |
340 if (impl != null) { | 349 if (impl != null) { |
341 return new Future(() => impl.onBackButton(_InputClientStubControl._inputCl
ientOnBackButtonResponseParamsFactory)); | 350 impl.onBackButton(callback); |
| 351 return; |
342 } | 352 } |
343 var params = new _InputClientOnBackButtonParams(); | 353 var params = new _InputClientOnBackButtonParams(); |
344 return ctrl.sendMessageWithRequestId( | 354 ctrl.sendMessageWithRequestId( |
345 params, | 355 params, |
346 _inputClientMethodOnBackButtonName, | 356 _inputClientMethodOnBackButtonName, |
347 -1, | 357 -1, |
348 bindings.MessageHeader.kMessageExpectsResponse); | 358 bindings.MessageHeader.kMessageExpectsResponse, |
| 359 callback); |
349 } | 360 } |
350 } | 361 } |
351 | 362 |
352 class _InputClientStubControl | 363 class _InputClientStubControl |
353 extends bindings.StubMessageHandler | 364 extends bindings.StubMessageHandler |
354 implements bindings.StubControl<InputClient> { | 365 implements bindings.StubControl<InputClient> { |
355 InputClient _impl; | 366 InputClient _impl; |
356 | 367 |
357 _InputClientStubControl.fromEndpoint( | 368 _InputClientStubControl.fromEndpoint( |
358 core.MojoMessagePipeEndpoint endpoint, [InputClient impl]) | 369 core.MojoMessagePipeEndpoint endpoint, [InputClient impl]) |
359 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 370 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
360 _impl = impl; | 371 _impl = impl; |
361 } | 372 } |
362 | 373 |
363 _InputClientStubControl.fromHandle( | 374 _InputClientStubControl.fromHandle( |
364 core.MojoHandle handle, [InputClient impl]) | 375 core.MojoHandle handle, [InputClient impl]) |
365 : super.fromHandle(handle, autoBegin: impl != null) { | 376 : super.fromHandle(handle, autoBegin: impl != null) { |
366 _impl = impl; | 377 _impl = impl; |
367 } | 378 } |
368 | 379 |
369 _InputClientStubControl.unbound([this._impl]) : super.unbound(); | 380 _InputClientStubControl.unbound([this._impl]) : super.unbound(); |
370 | 381 |
371 String get serviceName => InputClient.serviceName; | 382 String get serviceName => InputClient.serviceName; |
372 | 383 |
373 | 384 |
374 static InputClientOnBackButtonResponseParams _inputClientOnBackButtonResponseP
aramsFactory() { | 385 Function _inputClientOnBackButtonResponseParamsResponder( |
375 var result = new InputClientOnBackButtonResponseParams(); | 386 int requestId) { |
376 return result; | 387 return () { |
| 388 var result = new InputClientOnBackButtonResponseParams(); |
| 389 sendResponse(buildResponseWithId( |
| 390 result, |
| 391 _inputClientMethodOnBackButtonName, |
| 392 requestId, |
| 393 bindings.MessageHeader.kMessageIsResponse)); |
| 394 }; |
377 } | 395 } |
378 | 396 |
379 dynamic handleMessage(bindings.ServiceMessage message) { | 397 void handleMessage(bindings.ServiceMessage message) { |
380 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 398 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
381 return bindings.ControlMessageHandler.handleMessage(this, | 399 bindings.ControlMessageHandler.handleMessage( |
382 0, | 400 this, 0, message); |
383 message); | 401 return; |
384 } | 402 } |
385 if (_impl == null) { | 403 if (_impl == null) { |
386 throw new core.MojoApiError("$this has no implementation set"); | 404 throw new core.MojoApiError("$this has no implementation set"); |
387 } | 405 } |
388 switch (message.header.type) { | 406 switch (message.header.type) { |
389 case _inputClientMethodOnBackButtonName: | 407 case _inputClientMethodOnBackButtonName: |
390 var response = _impl.onBackButton(_inputClientOnBackButtonResponseParams
Factory); | 408 _impl.onBackButton(_inputClientOnBackButtonResponseParamsResponder(messa
ge.header.requestId)); |
391 if (response is Future) { | |
392 return response.then((response) { | |
393 if (response != null) { | |
394 return buildResponseWithId( | |
395 response, | |
396 _inputClientMethodOnBackButtonName, | |
397 message.header.requestId, | |
398 bindings.MessageHeader.kMessageIsResponse); | |
399 } | |
400 }); | |
401 } else if (response != null) { | |
402 return buildResponseWithId( | |
403 response, | |
404 _inputClientMethodOnBackButtonName, | |
405 message.header.requestId, | |
406 bindings.MessageHeader.kMessageIsResponse); | |
407 } | |
408 break; | 409 break; |
409 default: | 410 default: |
410 throw new bindings.MojoCodecError("Unexpected message name"); | 411 throw new bindings.MojoCodecError("Unexpected message name"); |
411 break; | 412 break; |
412 } | 413 } |
413 return null; | |
414 } | 414 } |
415 | 415 |
416 InputClient get impl => _impl; | 416 InputClient get impl => _impl; |
417 set impl(InputClient d) { | 417 set impl(InputClient d) { |
418 if (d == null) { | 418 if (d == null) { |
419 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 419 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
420 } | 420 } |
421 if (isBound && (_impl == null)) { | 421 if (isBound && (_impl == null)) { |
422 beginHandlingEvents(); | 422 beginHandlingEvents(); |
423 } | 423 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 core.MojoHandle handle, [InputClient impl]) | 457 core.MojoHandle handle, [InputClient impl]) |
458 : super(new _InputClientStubControl.fromHandle(handle, impl)); | 458 : super(new _InputClientStubControl.fromHandle(handle, impl)); |
459 | 459 |
460 static InputClientStub newFromEndpoint( | 460 static InputClientStub newFromEndpoint( |
461 core.MojoMessagePipeEndpoint endpoint) { | 461 core.MojoMessagePipeEndpoint endpoint) { |
462 assert(endpoint.setDescription("For InputClientStub")); | 462 assert(endpoint.setDescription("For InputClientStub")); |
463 return new InputClientStub.fromEndpoint(endpoint); | 463 return new InputClientStub.fromEndpoint(endpoint); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 dynamic onBackButton([Function responseFactory = null]) { | 467 void onBackButton(void callback()) { |
468 return impl.onBackButton(responseFactory); | 468 return impl.onBackButton(callback); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 const int _inputServiceMethodSetClientName = 0; | 472 const int _inputServiceMethodSetClientName = 0; |
473 | 473 |
474 class _InputServiceServiceDescription implements service_describer.ServiceDescri
ption { | 474 class _InputServiceServiceDescription implements service_describer.ServiceDescri
ption { |
475 dynamic getTopLevelInterface([Function responseFactory]) => | 475 void getTopLevelInterface(Function responder) { |
476 responseFactory(null); | 476 responder(null); |
| 477 } |
477 | 478 |
478 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 479 void getTypeDefinition(String typeKey, Function responder) { |
479 responseFactory(null); | 480 responder(null); |
| 481 } |
480 | 482 |
481 dynamic getAllTypeDefinitions([Function responseFactory]) => | 483 void getAllTypeDefinitions(Function responder) { |
482 responseFactory(null); | 484 responder(null); |
| 485 } |
483 } | 486 } |
484 | 487 |
485 abstract class InputService { | 488 abstract class InputService { |
486 static const String serviceName = "input::InputService"; | 489 static const String serviceName = "input::InputService"; |
487 | 490 |
488 static service_describer.ServiceDescription _cachedServiceDescription; | 491 static service_describer.ServiceDescription _cachedServiceDescription; |
489 static service_describer.ServiceDescription get serviceDescription { | 492 static service_describer.ServiceDescription get serviceDescription { |
490 if (_cachedServiceDescription == null) { | 493 if (_cachedServiceDescription == null) { |
491 _cachedServiceDescription = new _InputServiceServiceDescription(); | 494 _cachedServiceDescription = new _InputServiceServiceDescription(); |
492 } | 495 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 : super.fromHandle(handle, autoBegin: impl != null) { | 625 : super.fromHandle(handle, autoBegin: impl != null) { |
623 _impl = impl; | 626 _impl = impl; |
624 } | 627 } |
625 | 628 |
626 _InputServiceStubControl.unbound([this._impl]) : super.unbound(); | 629 _InputServiceStubControl.unbound([this._impl]) : super.unbound(); |
627 | 630 |
628 String get serviceName => InputService.serviceName; | 631 String get serviceName => InputService.serviceName; |
629 | 632 |
630 | 633 |
631 | 634 |
632 dynamic handleMessage(bindings.ServiceMessage message) { | 635 void handleMessage(bindings.ServiceMessage message) { |
633 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 636 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
634 return bindings.ControlMessageHandler.handleMessage(this, | 637 bindings.ControlMessageHandler.handleMessage( |
635 0, | 638 this, 0, message); |
636 message); | 639 return; |
637 } | 640 } |
638 if (_impl == null) { | 641 if (_impl == null) { |
639 throw new core.MojoApiError("$this has no implementation set"); | 642 throw new core.MojoApiError("$this has no implementation set"); |
640 } | 643 } |
641 switch (message.header.type) { | 644 switch (message.header.type) { |
642 case _inputServiceMethodSetClientName: | 645 case _inputServiceMethodSetClientName: |
643 var params = _InputServiceSetClientParams.deserialize( | 646 var params = _InputServiceSetClientParams.deserialize( |
644 message.payload); | 647 message.payload); |
645 _impl.setClient(params.client); | 648 _impl.setClient(params.client); |
646 break; | 649 break; |
647 default: | 650 default: |
648 throw new bindings.MojoCodecError("Unexpected message name"); | 651 throw new bindings.MojoCodecError("Unexpected message name"); |
649 break; | 652 break; |
650 } | 653 } |
651 return null; | |
652 } | 654 } |
653 | 655 |
654 InputService get impl => _impl; | 656 InputService get impl => _impl; |
655 set impl(InputService d) { | 657 set impl(InputService d) { |
656 if (d == null) { | 658 if (d == null) { |
657 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 659 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
658 } | 660 } |
659 if (isBound && (_impl == null)) { | 661 if (isBound && (_impl == null)) { |
660 beginHandlingEvents(); | 662 beginHandlingEvents(); |
661 } | 663 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 704 } |
703 | 705 |
704 | 706 |
705 void setClient(InputClientInterface client) { | 707 void setClient(InputClientInterface client) { |
706 return impl.setClient(client); | 708 return impl.setClient(client); |
707 } | 709 } |
708 } | 710 } |
709 | 711 |
710 | 712 |
711 | 713 |
OLD | NEW |