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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/speech_recognizer/speech_recognizer.mojom.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge 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
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 speech_recognizer_mojom; 4 library speech_recognizer_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 class Error extends bindings.MojoEnum { 10 class Error extends bindings.MojoEnum {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 class UtteranceCandidate extends bindings.Struct { 113 class UtteranceCandidate extends bindings.Struct {
114 static const List<bindings.StructDataHeader> kVersions = const [ 114 static const List<bindings.StructDataHeader> kVersions = const [
115 const bindings.StructDataHeader(24, 0) 115 const bindings.StructDataHeader(24, 0)
116 ]; 116 ];
117 String text = null; 117 String text = null;
118 double confidenceScore = 0.0; 118 double confidenceScore = 0.0;
119 119
120 UtteranceCandidate() : super(kVersions.last.size); 120 UtteranceCandidate() : super(kVersions.last.size);
121 121
122 UtteranceCandidate.init(
123 String this.text,
124 double this.confidenceScore
125 ) : super(kVersions.last.size);
126
122 static UtteranceCandidate deserialize(bindings.Message message) { 127 static UtteranceCandidate deserialize(bindings.Message message) {
123 var decoder = new bindings.Decoder(message); 128 var decoder = new bindings.Decoder(message);
124 var result = decode(decoder); 129 var result = decode(decoder);
125 if (decoder.excessHandles != null) { 130 if (decoder.excessHandles != null) {
126 decoder.excessHandles.forEach((h) => h.close()); 131 decoder.excessHandles.forEach((h) => h.close());
127 } 132 }
128 return result; 133 return result;
129 } 134 }
130 135
131 static UtteranceCandidate decode(bindings.Decoder decoder0) { 136 static UtteranceCandidate decode(bindings.Decoder decoder0) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 202
198 203
199 class _SpeechRecognizerListenerOnRecognizerErrorParams extends bindings.Struct { 204 class _SpeechRecognizerListenerOnRecognizerErrorParams extends bindings.Struct {
200 static const List<bindings.StructDataHeader> kVersions = const [ 205 static const List<bindings.StructDataHeader> kVersions = const [
201 const bindings.StructDataHeader(16, 0) 206 const bindings.StructDataHeader(16, 0)
202 ]; 207 ];
203 Error errorCode = null; 208 Error errorCode = null;
204 209
205 _SpeechRecognizerListenerOnRecognizerErrorParams() : super(kVersions.last.size ); 210 _SpeechRecognizerListenerOnRecognizerErrorParams() : super(kVersions.last.size );
206 211
212 _SpeechRecognizerListenerOnRecognizerErrorParams.init(
213 Error this.errorCode
214 ) : super(kVersions.last.size);
215
207 static _SpeechRecognizerListenerOnRecognizerErrorParams deserialize(bindings.M essage message) { 216 static _SpeechRecognizerListenerOnRecognizerErrorParams deserialize(bindings.M essage message) {
208 var decoder = new bindings.Decoder(message); 217 var decoder = new bindings.Decoder(message);
209 var result = decode(decoder); 218 var result = decode(decoder);
210 if (decoder.excessHandles != null) { 219 if (decoder.excessHandles != null) {
211 decoder.excessHandles.forEach((h) => h.close()); 220 decoder.excessHandles.forEach((h) => h.close());
212 } 221 }
213 return result; 222 return result;
214 } 223 }
215 224
216 static _SpeechRecognizerListenerOnRecognizerErrorParams decode(bindings.Decode r decoder0) { 225 static _SpeechRecognizerListenerOnRecognizerErrorParams decode(bindings.Decode r decoder0) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 283
275 class _SpeechRecognizerListenerOnResultsParams extends bindings.Struct { 284 class _SpeechRecognizerListenerOnResultsParams extends bindings.Struct {
276 static const List<bindings.StructDataHeader> kVersions = const [ 285 static const List<bindings.StructDataHeader> kVersions = const [
277 const bindings.StructDataHeader(24, 0) 286 const bindings.StructDataHeader(24, 0)
278 ]; 287 ];
279 List<UtteranceCandidate> results = null; 288 List<UtteranceCandidate> results = null;
280 bool complete = false; 289 bool complete = false;
281 290
282 _SpeechRecognizerListenerOnResultsParams() : super(kVersions.last.size); 291 _SpeechRecognizerListenerOnResultsParams() : super(kVersions.last.size);
283 292
293 _SpeechRecognizerListenerOnResultsParams.init(
294 List<UtteranceCandidate> this.results,
295 bool this.complete
296 ) : super(kVersions.last.size);
297
284 static _SpeechRecognizerListenerOnResultsParams deserialize(bindings.Message m essage) { 298 static _SpeechRecognizerListenerOnResultsParams deserialize(bindings.Message m essage) {
285 var decoder = new bindings.Decoder(message); 299 var decoder = new bindings.Decoder(message);
286 var result = decode(decoder); 300 var result = decode(decoder);
287 if (decoder.excessHandles != null) { 301 if (decoder.excessHandles != null) {
288 decoder.excessHandles.forEach((h) => h.close()); 302 decoder.excessHandles.forEach((h) => h.close());
289 } 303 }
290 return result; 304 return result;
291 } 305 }
292 306
293 static _SpeechRecognizerListenerOnResultsParams decode(bindings.Decoder decode r0) { 307 static _SpeechRecognizerListenerOnResultsParams decode(bindings.Decoder decode r0) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 389
376 390
377 class _SpeechRecognizerListenerOnSoundLevelChangedParams extends bindings.Struct { 391 class _SpeechRecognizerListenerOnSoundLevelChangedParams extends bindings.Struct {
378 static const List<bindings.StructDataHeader> kVersions = const [ 392 static const List<bindings.StructDataHeader> kVersions = const [
379 const bindings.StructDataHeader(16, 0) 393 const bindings.StructDataHeader(16, 0)
380 ]; 394 ];
381 double rmsDb = 0.0; 395 double rmsDb = 0.0;
382 396
383 _SpeechRecognizerListenerOnSoundLevelChangedParams() : super(kVersions.last.si ze); 397 _SpeechRecognizerListenerOnSoundLevelChangedParams() : super(kVersions.last.si ze);
384 398
399 _SpeechRecognizerListenerOnSoundLevelChangedParams.init(
400 double this.rmsDb
401 ) : super(kVersions.last.size);
402
385 static _SpeechRecognizerListenerOnSoundLevelChangedParams deserialize(bindings .Message message) { 403 static _SpeechRecognizerListenerOnSoundLevelChangedParams deserialize(bindings .Message message) {
386 var decoder = new bindings.Decoder(message); 404 var decoder = new bindings.Decoder(message);
387 var result = decode(decoder); 405 var result = decode(decoder);
388 if (decoder.excessHandles != null) { 406 if (decoder.excessHandles != null) {
389 decoder.excessHandles.forEach((h) => h.close()); 407 decoder.excessHandles.forEach((h) => h.close());
390 } 408 }
391 return result; 409 return result;
392 } 410 }
393 411
394 static _SpeechRecognizerListenerOnSoundLevelChangedParams decode(bindings.Deco der decoder0) { 412 static _SpeechRecognizerListenerOnSoundLevelChangedParams decode(bindings.Deco der decoder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 465
448 466
449 class _SpeechRecognizerServiceListenParams extends bindings.Struct { 467 class _SpeechRecognizerServiceListenParams extends bindings.Struct {
450 static const List<bindings.StructDataHeader> kVersions = const [ 468 static const List<bindings.StructDataHeader> kVersions = const [
451 const bindings.StructDataHeader(16, 0) 469 const bindings.StructDataHeader(16, 0)
452 ]; 470 ];
453 SpeechRecognizerListenerInterface listener = null; 471 SpeechRecognizerListenerInterface listener = null;
454 472
455 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size); 473 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size);
456 474
475 _SpeechRecognizerServiceListenParams.init(
476 SpeechRecognizerListenerInterface this.listener
477 ) : super(kVersions.last.size);
478
457 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa ge) { 479 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa ge) {
458 var decoder = new bindings.Decoder(message); 480 var decoder = new bindings.Decoder(message);
459 var result = decode(decoder); 481 var result = decode(decoder);
460 if (decoder.excessHandles != null) { 482 if (decoder.excessHandles != null) {
461 decoder.excessHandles.forEach((h) => h.close()); 483 decoder.excessHandles.forEach((h) => h.close());
462 } 484 }
463 return result; 485 return result;
464 } 486 }
465 487
466 static _SpeechRecognizerServiceListenParams decode(bindings.Decoder decoder0) { 488 static _SpeechRecognizerServiceListenParams decode(bindings.Decoder decoder0) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 539 }
518 540
519 541
520 class _SpeechRecognizerServiceStopListeningParams extends bindings.Struct { 542 class _SpeechRecognizerServiceStopListeningParams extends bindings.Struct {
521 static const List<bindings.StructDataHeader> kVersions = const [ 543 static const List<bindings.StructDataHeader> kVersions = const [
522 const bindings.StructDataHeader(8, 0) 544 const bindings.StructDataHeader(8, 0)
523 ]; 545 ];
524 546
525 _SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size); 547 _SpeechRecognizerServiceStopListeningParams() : super(kVersions.last.size);
526 548
549 _SpeechRecognizerServiceStopListeningParams.init(
550 ) : super(kVersions.last.size);
551
527 static _SpeechRecognizerServiceStopListeningParams deserialize(bindings.Messag e message) { 552 static _SpeechRecognizerServiceStopListeningParams deserialize(bindings.Messag e message) {
528 var decoder = new bindings.Decoder(message); 553 var decoder = new bindings.Decoder(message);
529 var result = decode(decoder); 554 var result = decode(decoder);
530 if (decoder.excessHandles != null) { 555 if (decoder.excessHandles != null) {
531 decoder.excessHandles.forEach((h) => h.close()); 556 decoder.excessHandles.forEach((h) => h.close());
532 } 557 }
533 return result; 558 return result;
534 } 559 }
535 560
536 static _SpeechRecognizerServiceStopListeningParams decode(bindings.Decoder dec oder0) { 561 static _SpeechRecognizerServiceStopListeningParams decode(bindings.Decoder dec oder0) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 Map map = new Map(); 597 Map map = new Map();
573 return map; 598 return map;
574 } 599 }
575 } 600 }
576 601
577 const int _speechRecognizerListenerMethodOnRecognizerErrorName = 0; 602 const int _speechRecognizerListenerMethodOnRecognizerErrorName = 0;
578 const int _speechRecognizerListenerMethodOnResultsName = 1; 603 const int _speechRecognizerListenerMethodOnResultsName = 1;
579 const int _speechRecognizerListenerMethodOnSoundLevelChangedName = 2; 604 const int _speechRecognizerListenerMethodOnSoundLevelChangedName = 2;
580 605
581 class _SpeechRecognizerListenerServiceDescription implements service_describer.S erviceDescription { 606 class _SpeechRecognizerListenerServiceDescription implements service_describer.S erviceDescription {
582 dynamic getTopLevelInterface([Function responseFactory]) => 607 void getTopLevelInterface(Function responder) {
583 responseFactory(null); 608 responder(null);
609 }
584 610
585 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 611 void getTypeDefinition(String typeKey, Function responder) {
586 responseFactory(null); 612 responder(null);
613 }
587 614
588 dynamic getAllTypeDefinitions([Function responseFactory]) => 615 void getAllTypeDefinitions(Function responder) {
589 responseFactory(null); 616 responder(null);
617 }
590 } 618 }
591 619
592 abstract class SpeechRecognizerListener { 620 abstract class SpeechRecognizerListener {
593 static const String serviceName = null; 621 static const String serviceName = null;
594 622
595 static service_describer.ServiceDescription _cachedServiceDescription; 623 static service_describer.ServiceDescription _cachedServiceDescription;
596 static service_describer.ServiceDescription get serviceDescription { 624 static service_describer.ServiceDescription get serviceDescription {
597 if (_cachedServiceDescription == null) { 625 if (_cachedServiceDescription == null) {
598 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio n(); 626 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio n();
599 } 627 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 : super.fromHandle(handle, autoBegin: impl != null) { 788 : super.fromHandle(handle, autoBegin: impl != null) {
761 _impl = impl; 789 _impl = impl;
762 } 790 }
763 791
764 _SpeechRecognizerListenerStubControl.unbound([this._impl]) : super.unbound(); 792 _SpeechRecognizerListenerStubControl.unbound([this._impl]) : super.unbound();
765 793
766 String get serviceName => SpeechRecognizerListener.serviceName; 794 String get serviceName => SpeechRecognizerListener.serviceName;
767 795
768 796
769 797
770 dynamic handleMessage(bindings.ServiceMessage message) { 798 void handleMessage(bindings.ServiceMessage message) {
771 if (bindings.ControlMessageHandler.isControlMessage(message)) { 799 if (bindings.ControlMessageHandler.isControlMessage(message)) {
772 return bindings.ControlMessageHandler.handleMessage(this, 800 bindings.ControlMessageHandler.handleMessage(
773 0, 801 this, 0, message);
774 message); 802 return;
775 } 803 }
776 if (_impl == null) { 804 if (_impl == null) {
777 throw new core.MojoApiError("$this has no implementation set"); 805 throw new core.MojoApiError("$this has no implementation set");
778 } 806 }
779 switch (message.header.type) { 807 switch (message.header.type) {
780 case _speechRecognizerListenerMethodOnRecognizerErrorName: 808 case _speechRecognizerListenerMethodOnRecognizerErrorName:
781 var params = _SpeechRecognizerListenerOnRecognizerErrorParams.deserializ e( 809 var params = _SpeechRecognizerListenerOnRecognizerErrorParams.deserializ e(
782 message.payload); 810 message.payload);
783 _impl.onRecognizerError(params.errorCode); 811 _impl.onRecognizerError(params.errorCode);
784 break; 812 break;
785 case _speechRecognizerListenerMethodOnResultsName: 813 case _speechRecognizerListenerMethodOnResultsName:
786 var params = _SpeechRecognizerListenerOnResultsParams.deserialize( 814 var params = _SpeechRecognizerListenerOnResultsParams.deserialize(
787 message.payload); 815 message.payload);
788 _impl.onResults(params.results, params.complete); 816 _impl.onResults(params.results, params.complete);
789 break; 817 break;
790 case _speechRecognizerListenerMethodOnSoundLevelChangedName: 818 case _speechRecognizerListenerMethodOnSoundLevelChangedName:
791 var params = _SpeechRecognizerListenerOnSoundLevelChangedParams.deserial ize( 819 var params = _SpeechRecognizerListenerOnSoundLevelChangedParams.deserial ize(
792 message.payload); 820 message.payload);
793 _impl.onSoundLevelChanged(params.rmsDb); 821 _impl.onSoundLevelChanged(params.rmsDb);
794 break; 822 break;
795 default: 823 default:
796 throw new bindings.MojoCodecError("Unexpected message name"); 824 throw new bindings.MojoCodecError("Unexpected message name");
797 break; 825 break;
798 } 826 }
799 return null;
800 } 827 }
801 828
802 SpeechRecognizerListener get impl => _impl; 829 SpeechRecognizerListener get impl => _impl;
803 set impl(SpeechRecognizerListener d) { 830 set impl(SpeechRecognizerListener d) {
804 if (d == null) { 831 if (d == null) {
805 throw new core.MojoApiError("$this: Cannot set a null implementation"); 832 throw new core.MojoApiError("$this: Cannot set a null implementation");
806 } 833 }
807 if (isBound && (_impl == null)) { 834 if (isBound && (_impl == null)) {
808 beginHandlingEvents(); 835 beginHandlingEvents();
809 } 836 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 885 }
859 void onSoundLevelChanged(double rmsDb) { 886 void onSoundLevelChanged(double rmsDb) {
860 return impl.onSoundLevelChanged(rmsDb); 887 return impl.onSoundLevelChanged(rmsDb);
861 } 888 }
862 } 889 }
863 890
864 const int _speechRecognizerServiceMethodListenName = 0; 891 const int _speechRecognizerServiceMethodListenName = 0;
865 const int _speechRecognizerServiceMethodStopListeningName = 1; 892 const int _speechRecognizerServiceMethodStopListeningName = 1;
866 893
867 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se rviceDescription { 894 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se rviceDescription {
868 dynamic getTopLevelInterface([Function responseFactory]) => 895 void getTopLevelInterface(Function responder) {
869 responseFactory(null); 896 responder(null);
897 }
870 898
871 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 899 void getTypeDefinition(String typeKey, Function responder) {
872 responseFactory(null); 900 responder(null);
901 }
873 902
874 dynamic getAllTypeDefinitions([Function responseFactory]) => 903 void getAllTypeDefinitions(Function responder) {
875 responseFactory(null); 904 responder(null);
905 }
876 } 906 }
877 907
878 abstract class SpeechRecognizerService { 908 abstract class SpeechRecognizerService {
879 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ; 909 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ;
880 910
881 static service_describer.ServiceDescription _cachedServiceDescription; 911 static service_describer.ServiceDescription _cachedServiceDescription;
882 static service_describer.ServiceDescription get serviceDescription { 912 static service_describer.ServiceDescription get serviceDescription {
883 if (_cachedServiceDescription == null) { 913 if (_cachedServiceDescription == null) {
884 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription (); 914 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription ();
885 } 915 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 : super.fromHandle(handle, autoBegin: impl != null) { 1059 : super.fromHandle(handle, autoBegin: impl != null) {
1030 _impl = impl; 1060 _impl = impl;
1031 } 1061 }
1032 1062
1033 _SpeechRecognizerServiceStubControl.unbound([this._impl]) : super.unbound(); 1063 _SpeechRecognizerServiceStubControl.unbound([this._impl]) : super.unbound();
1034 1064
1035 String get serviceName => SpeechRecognizerService.serviceName; 1065 String get serviceName => SpeechRecognizerService.serviceName;
1036 1066
1037 1067
1038 1068
1039 dynamic handleMessage(bindings.ServiceMessage message) { 1069 void handleMessage(bindings.ServiceMessage message) {
1040 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1070 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1041 return bindings.ControlMessageHandler.handleMessage(this, 1071 bindings.ControlMessageHandler.handleMessage(
1042 0, 1072 this, 0, message);
1043 message); 1073 return;
1044 } 1074 }
1045 if (_impl == null) { 1075 if (_impl == null) {
1046 throw new core.MojoApiError("$this has no implementation set"); 1076 throw new core.MojoApiError("$this has no implementation set");
1047 } 1077 }
1048 switch (message.header.type) { 1078 switch (message.header.type) {
1049 case _speechRecognizerServiceMethodListenName: 1079 case _speechRecognizerServiceMethodListenName:
1050 var params = _SpeechRecognizerServiceListenParams.deserialize( 1080 var params = _SpeechRecognizerServiceListenParams.deserialize(
1051 message.payload); 1081 message.payload);
1052 _impl.listen(params.listener); 1082 _impl.listen(params.listener);
1053 break; 1083 break;
1054 case _speechRecognizerServiceMethodStopListeningName: 1084 case _speechRecognizerServiceMethodStopListeningName:
1055 _impl.stopListening(); 1085 _impl.stopListening();
1056 break; 1086 break;
1057 default: 1087 default:
1058 throw new bindings.MojoCodecError("Unexpected message name"); 1088 throw new bindings.MojoCodecError("Unexpected message name");
1059 break; 1089 break;
1060 } 1090 }
1061 return null;
1062 } 1091 }
1063 1092
1064 SpeechRecognizerService get impl => _impl; 1093 SpeechRecognizerService get impl => _impl;
1065 set impl(SpeechRecognizerService d) { 1094 set impl(SpeechRecognizerService d) {
1066 if (d == null) { 1095 if (d == null) {
1067 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1096 throw new core.MojoApiError("$this: Cannot set a null implementation");
1068 } 1097 }
1069 if (isBound && (_impl == null)) { 1098 if (isBound && (_impl == null)) {
1070 beginHandlingEvents(); 1099 beginHandlingEvents();
1071 } 1100 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 void listen(SpeechRecognizerListenerInterface listener) { 1144 void listen(SpeechRecognizerListenerInterface listener) {
1116 return impl.listen(listener); 1145 return impl.listen(listener);
1117 } 1146 }
1118 void stopListening() { 1147 void stopListening() {
1119 return impl.stopListening(); 1148 return impl.stopListening();
1120 } 1149 }
1121 } 1150 }
1122 1151
1123 1152
1124 1153
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698