| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 library speech_recognizer_mojom; | 5 library speech_recognizer_mojom; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
| 8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
| 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 10 | 10 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 impl.requireVersion(requiredVersion); | 720 impl.requireVersion(requiredVersion); |
| 721 } | 721 } |
| 722 | 722 |
| 723 String toString() { | 723 String toString() { |
| 724 return "SpeechRecognizerListenerProxy($impl)"; | 724 return "SpeechRecognizerListenerProxy($impl)"; |
| 725 } | 725 } |
| 726 } | 726 } |
| 727 | 727 |
| 728 | 728 |
| 729 class SpeechRecognizerListenerStub extends bindings.Stub { | 729 class SpeechRecognizerListenerStub extends bindings.Stub { |
| 730 SpeechRecognizerListener _impl = null; | 730 SpeechRecognizerListener _impl; |
| 731 | 731 |
| 732 SpeechRecognizerListenerStub.fromEndpoint( | 732 SpeechRecognizerListenerStub.fromEndpoint( |
| 733 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 733 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl]) |
| 734 : super.fromEndpoint(endpoint); | 734 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 735 _impl = impl; |
| 736 } |
| 735 | 737 |
| 736 SpeechRecognizerListenerStub.fromHandle(core.MojoHandle handle, [this._impl]) | 738 SpeechRecognizerListenerStub.fromHandle( |
| 737 : super.fromHandle(handle); | 739 core.MojoHandle handle, [SpeechRecognizerListener impl]) |
| 740 : super.fromHandle(handle, autoBegin: impl != null) { |
| 741 _impl = impl; |
| 742 } |
| 738 | 743 |
| 739 SpeechRecognizerListenerStub.unbound() : super.unbound(); | 744 SpeechRecognizerListenerStub.unbound() : super.unbound(); |
| 740 | 745 |
| 741 static SpeechRecognizerListenerStub newFromEndpoint( | 746 static SpeechRecognizerListenerStub newFromEndpoint( |
| 742 core.MojoMessagePipeEndpoint endpoint) { | 747 core.MojoMessagePipeEndpoint endpoint) { |
| 743 assert(endpoint.setDescription("For SpeechRecognizerListenerStub")); | 748 assert(endpoint.setDescription("For SpeechRecognizerListenerStub")); |
| 744 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint); | 749 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint); |
| 745 } | 750 } |
| 746 | 751 |
| 747 | 752 |
| 748 | 753 |
| 749 dynamic handleMessage(bindings.ServiceMessage message) { | 754 dynamic handleMessage(bindings.ServiceMessage message) { |
| 750 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 755 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 751 return bindings.ControlMessageHandler.handleMessage(this, | 756 return bindings.ControlMessageHandler.handleMessage(this, |
| 752 0, | 757 0, |
| 753 message); | 758 message); |
| 754 } | 759 } |
| 755 assert(_impl != null); | 760 if (_impl == null) { |
| 761 throw new core.MojoApiError("$this has no implementation set"); |
| 762 } |
| 756 switch (message.header.type) { | 763 switch (message.header.type) { |
| 757 case _speechRecognizerListenerMethodOnRecognizerErrorName: | 764 case _speechRecognizerListenerMethodOnRecognizerErrorName: |
| 758 var params = _SpeechRecognizerListenerOnRecognizerErrorParams.deserializ
e( | 765 var params = _SpeechRecognizerListenerOnRecognizerErrorParams.deserializ
e( |
| 759 message.payload); | 766 message.payload); |
| 760 _impl.onRecognizerError(params.errorCode); | 767 _impl.onRecognizerError(params.errorCode); |
| 761 break; | 768 break; |
| 762 case _speechRecognizerListenerMethodOnResultsName: | 769 case _speechRecognizerListenerMethodOnResultsName: |
| 763 var params = _SpeechRecognizerListenerOnResultsParams.deserialize( | 770 var params = _SpeechRecognizerListenerOnResultsParams.deserialize( |
| 764 message.payload); | 771 message.payload); |
| 765 _impl.onResults(params.results, params.complete); | 772 _impl.onResults(params.results, params.complete); |
| 766 break; | 773 break; |
| 767 case _speechRecognizerListenerMethodOnSoundLevelChangedName: | 774 case _speechRecognizerListenerMethodOnSoundLevelChangedName: |
| 768 var params = _SpeechRecognizerListenerOnSoundLevelChangedParams.deserial
ize( | 775 var params = _SpeechRecognizerListenerOnSoundLevelChangedParams.deserial
ize( |
| 769 message.payload); | 776 message.payload); |
| 770 _impl.onSoundLevelChanged(params.rmsDb); | 777 _impl.onSoundLevelChanged(params.rmsDb); |
| 771 break; | 778 break; |
| 772 default: | 779 default: |
| 773 throw new bindings.MojoCodecError("Unexpected message name"); | 780 throw new bindings.MojoCodecError("Unexpected message name"); |
| 774 break; | 781 break; |
| 775 } | 782 } |
| 776 return null; | 783 return null; |
| 777 } | 784 } |
| 778 | 785 |
| 779 SpeechRecognizerListener get impl => _impl; | 786 SpeechRecognizerListener get impl => _impl; |
| 780 set impl(SpeechRecognizerListener d) { | 787 set impl(SpeechRecognizerListener d) { |
| 781 assert(_impl == null); | 788 if (d == null) { |
| 789 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 790 } |
| 791 if (isBound && (_impl == null)) { |
| 792 beginHandlingEvents(); |
| 793 } |
| 782 _impl = d; | 794 _impl = d; |
| 783 } | 795 } |
| 784 | 796 |
| 797 @override |
| 798 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 799 super.bind(endpoint); |
| 800 if (!isOpen && (_impl != null)) { |
| 801 beginHandlingEvents(); |
| 802 } |
| 803 } |
| 804 |
| 785 String toString() { | 805 String toString() { |
| 786 var superString = super.toString(); | 806 var superString = super.toString(); |
| 787 return "SpeechRecognizerListenerStub($superString)"; | 807 return "SpeechRecognizerListenerStub($superString)"; |
| 788 } | 808 } |
| 789 | 809 |
| 790 int get version => 0; | 810 int get version => 0; |
| 791 | 811 |
| 792 static service_describer.ServiceDescription _cachedServiceDescription; | 812 static service_describer.ServiceDescription _cachedServiceDescription; |
| 793 static service_describer.ServiceDescription get serviceDescription { | 813 static service_describer.ServiceDescription get serviceDescription { |
| 794 if (_cachedServiceDescription == null) { | 814 if (_cachedServiceDescription == null) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 impl.requireVersion(requiredVersion); | 950 impl.requireVersion(requiredVersion); |
| 931 } | 951 } |
| 932 | 952 |
| 933 String toString() { | 953 String toString() { |
| 934 return "SpeechRecognizerServiceProxy($impl)"; | 954 return "SpeechRecognizerServiceProxy($impl)"; |
| 935 } | 955 } |
| 936 } | 956 } |
| 937 | 957 |
| 938 | 958 |
| 939 class SpeechRecognizerServiceStub extends bindings.Stub { | 959 class SpeechRecognizerServiceStub extends bindings.Stub { |
| 940 SpeechRecognizerService _impl = null; | 960 SpeechRecognizerService _impl; |
| 941 | 961 |
| 942 SpeechRecognizerServiceStub.fromEndpoint( | 962 SpeechRecognizerServiceStub.fromEndpoint( |
| 943 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 963 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl]) |
| 944 : super.fromEndpoint(endpoint); | 964 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 965 _impl = impl; |
| 966 } |
| 945 | 967 |
| 946 SpeechRecognizerServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 968 SpeechRecognizerServiceStub.fromHandle( |
| 947 : super.fromHandle(handle); | 969 core.MojoHandle handle, [SpeechRecognizerService impl]) |
| 970 : super.fromHandle(handle, autoBegin: impl != null) { |
| 971 _impl = impl; |
| 972 } |
| 948 | 973 |
| 949 SpeechRecognizerServiceStub.unbound() : super.unbound(); | 974 SpeechRecognizerServiceStub.unbound() : super.unbound(); |
| 950 | 975 |
| 951 static SpeechRecognizerServiceStub newFromEndpoint( | 976 static SpeechRecognizerServiceStub newFromEndpoint( |
| 952 core.MojoMessagePipeEndpoint endpoint) { | 977 core.MojoMessagePipeEndpoint endpoint) { |
| 953 assert(endpoint.setDescription("For SpeechRecognizerServiceStub")); | 978 assert(endpoint.setDescription("For SpeechRecognizerServiceStub")); |
| 954 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint); | 979 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint); |
| 955 } | 980 } |
| 956 | 981 |
| 957 | 982 |
| 958 | 983 |
| 959 dynamic handleMessage(bindings.ServiceMessage message) { | 984 dynamic handleMessage(bindings.ServiceMessage message) { |
| 960 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 985 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 961 return bindings.ControlMessageHandler.handleMessage(this, | 986 return bindings.ControlMessageHandler.handleMessage(this, |
| 962 0, | 987 0, |
| 963 message); | 988 message); |
| 964 } | 989 } |
| 965 assert(_impl != null); | 990 if (_impl == null) { |
| 991 throw new core.MojoApiError("$this has no implementation set"); |
| 992 } |
| 966 switch (message.header.type) { | 993 switch (message.header.type) { |
| 967 case _speechRecognizerServiceMethodListenName: | 994 case _speechRecognizerServiceMethodListenName: |
| 968 var params = _SpeechRecognizerServiceListenParams.deserialize( | 995 var params = _SpeechRecognizerServiceListenParams.deserialize( |
| 969 message.payload); | 996 message.payload); |
| 970 _impl.listen(params.listener); | 997 _impl.listen(params.listener); |
| 971 break; | 998 break; |
| 972 case _speechRecognizerServiceMethodStopListeningName: | 999 case _speechRecognizerServiceMethodStopListeningName: |
| 973 _impl.stopListening(); | 1000 _impl.stopListening(); |
| 974 break; | 1001 break; |
| 975 default: | 1002 default: |
| 976 throw new bindings.MojoCodecError("Unexpected message name"); | 1003 throw new bindings.MojoCodecError("Unexpected message name"); |
| 977 break; | 1004 break; |
| 978 } | 1005 } |
| 979 return null; | 1006 return null; |
| 980 } | 1007 } |
| 981 | 1008 |
| 982 SpeechRecognizerService get impl => _impl; | 1009 SpeechRecognizerService get impl => _impl; |
| 983 set impl(SpeechRecognizerService d) { | 1010 set impl(SpeechRecognizerService d) { |
| 984 assert(_impl == null); | 1011 if (d == null) { |
| 1012 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1013 } |
| 1014 if (isBound && (_impl == null)) { |
| 1015 beginHandlingEvents(); |
| 1016 } |
| 985 _impl = d; | 1017 _impl = d; |
| 986 } | 1018 } |
| 987 | 1019 |
| 1020 @override |
| 1021 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1022 super.bind(endpoint); |
| 1023 if (!isOpen && (_impl != null)) { |
| 1024 beginHandlingEvents(); |
| 1025 } |
| 1026 } |
| 1027 |
| 988 String toString() { | 1028 String toString() { |
| 989 var superString = super.toString(); | 1029 var superString = super.toString(); |
| 990 return "SpeechRecognizerServiceStub($superString)"; | 1030 return "SpeechRecognizerServiceStub($superString)"; |
| 991 } | 1031 } |
| 992 | 1032 |
| 993 int get version => 0; | 1033 int get version => 0; |
| 994 | 1034 |
| 995 static service_describer.ServiceDescription _cachedServiceDescription; | 1035 static service_describer.ServiceDescription _cachedServiceDescription; |
| 996 static service_describer.ServiceDescription get serviceDescription { | 1036 static service_describer.ServiceDescription get serviceDescription { |
| 997 if (_cachedServiceDescription == null) { | 1037 if (_cachedServiceDescription == null) { |
| 998 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription
(); | 1038 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription
(); |
| 999 } | 1039 } |
| 1000 return _cachedServiceDescription; | 1040 return _cachedServiceDescription; |
| 1001 } | 1041 } |
| 1002 } | 1042 } |
| 1003 | 1043 |
| 1004 | 1044 |
| 1005 | 1045 |
| OLD | NEW |