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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 map["rmsDb"] = rmsDb; | 444 map["rmsDb"] = rmsDb; |
445 return map; | 445 return map; |
446 } | 446 } |
447 } | 447 } |
448 | 448 |
449 | 449 |
450 class _SpeechRecognizerServiceListenParams extends bindings.Struct { | 450 class _SpeechRecognizerServiceListenParams extends bindings.Struct { |
451 static const List<bindings.StructDataHeader> kVersions = const [ | 451 static const List<bindings.StructDataHeader> kVersions = const [ |
452 const bindings.StructDataHeader(16, 0) | 452 const bindings.StructDataHeader(16, 0) |
453 ]; | 453 ]; |
454 Object listener = null; | 454 SpeechRecognizerListenerInterface listener = null; |
455 | 455 |
456 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size); | 456 _SpeechRecognizerServiceListenParams() : super(kVersions.last.size); |
457 | 457 |
458 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa
ge) { | 458 static _SpeechRecognizerServiceListenParams deserialize(bindings.Message messa
ge) { |
459 var decoder = new bindings.Decoder(message); | 459 var decoder = new bindings.Decoder(message); |
460 var result = decode(decoder); | 460 var result = decode(decoder); |
461 if (decoder.excessHandles != null) { | 461 if (decoder.excessHandles != null) { |
462 decoder.excessHandles.forEach((h) => h.close()); | 462 decoder.excessHandles.forEach((h) => h.close()); |
463 } | 463 } |
464 return result; | 464 return result; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 586 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
587 responseFactory(null); | 587 responseFactory(null); |
588 | 588 |
589 dynamic getAllTypeDefinitions([Function responseFactory]) => | 589 dynamic getAllTypeDefinitions([Function responseFactory]) => |
590 responseFactory(null); | 590 responseFactory(null); |
591 } | 591 } |
592 | 592 |
593 abstract class SpeechRecognizerListener { | 593 abstract class SpeechRecognizerListener { |
594 static const String serviceName = null; | 594 static const String serviceName = null; |
| 595 |
| 596 static service_describer.ServiceDescription _cachedServiceDescription; |
| 597 static service_describer.ServiceDescription get serviceDescription { |
| 598 if (_cachedServiceDescription == null) { |
| 599 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio
n(); |
| 600 } |
| 601 return _cachedServiceDescription; |
| 602 } |
| 603 |
| 604 static SpeechRecognizerListenerProxy connectToService( |
| 605 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 606 SpeechRecognizerListenerProxy p = new SpeechRecognizerListenerProxy.unbound(
); |
| 607 String name = serviceName ?? SpeechRecognizerListener.serviceName; |
| 608 if ((name == null) || name.isEmpty) { |
| 609 throw new core.MojoApiError( |
| 610 "If an interface has no ServiceName, then one must be provided."); |
| 611 } |
| 612 s.connectToService(url, p, name); |
| 613 return p; |
| 614 } |
595 void onRecognizerError(Error errorCode); | 615 void onRecognizerError(Error errorCode); |
596 void onResults(List<UtteranceCandidate> results, bool complete); | 616 void onResults(List<UtteranceCandidate> results, bool complete); |
597 void onSoundLevelChanged(double rmsDb); | 617 void onSoundLevelChanged(double rmsDb); |
598 } | 618 } |
599 | 619 |
| 620 abstract class SpeechRecognizerListenerInterface |
| 621 implements bindings.MojoInterface<SpeechRecognizerListener>, |
| 622 SpeechRecognizerListener { |
| 623 factory SpeechRecognizerListenerInterface([SpeechRecognizerListener impl]) => |
| 624 new SpeechRecognizerListenerStub.unbound(impl); |
| 625 factory SpeechRecognizerListenerInterface.fromEndpoint( |
| 626 core.MojoMessagePipeEndpoint endpoint, |
| 627 [SpeechRecognizerListener impl]) => |
| 628 new SpeechRecognizerListenerStub.fromEndpoint(endpoint, impl); |
| 629 } |
| 630 |
| 631 abstract class SpeechRecognizerListenerInterfaceRequest |
| 632 implements bindings.MojoInterface<SpeechRecognizerListener>, |
| 633 SpeechRecognizerListener { |
| 634 factory SpeechRecognizerListenerInterfaceRequest() => |
| 635 new SpeechRecognizerListenerProxy.unbound(); |
| 636 } |
| 637 |
600 class _SpeechRecognizerListenerProxyControl | 638 class _SpeechRecognizerListenerProxyControl |
601 extends bindings.ProxyMessageHandler | 639 extends bindings.ProxyMessageHandler |
602 implements bindings.ProxyControl { | 640 implements bindings.ProxyControl<SpeechRecognizerListener> { |
603 _SpeechRecognizerListenerProxyControl.fromEndpoint( | 641 _SpeechRecognizerListenerProxyControl.fromEndpoint( |
604 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 642 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
605 | 643 |
606 _SpeechRecognizerListenerProxyControl.fromHandle( | 644 _SpeechRecognizerListenerProxyControl.fromHandle( |
607 core.MojoHandle handle) : super.fromHandle(handle); | 645 core.MojoHandle handle) : super.fromHandle(handle); |
608 | 646 |
609 _SpeechRecognizerListenerProxyControl.unbound() : super.unbound(); | 647 _SpeechRecognizerListenerProxyControl.unbound() : super.unbound(); |
610 | 648 |
611 service_describer.ServiceDescription get serviceDescription => | |
612 new _SpeechRecognizerListenerServiceDescription(); | |
613 | |
614 String get serviceName => SpeechRecognizerListener.serviceName; | 649 String get serviceName => SpeechRecognizerListener.serviceName; |
615 | 650 |
616 void handleResponse(bindings.ServiceMessage message) { | 651 void handleResponse(bindings.ServiceMessage message) { |
617 switch (message.header.type) { | 652 switch (message.header.type) { |
618 default: | 653 default: |
619 proxyError("Unexpected message type: ${message.header.type}"); | 654 proxyError("Unexpected message type: ${message.header.type}"); |
620 close(immediate: true); | 655 close(immediate: true); |
621 break; | 656 break; |
622 } | 657 } |
623 } | 658 } |
624 | 659 |
| 660 SpeechRecognizerListener get impl => null; |
| 661 set impl(SpeechRecognizerListener _) { |
| 662 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 663 } |
| 664 |
625 @override | 665 @override |
626 String toString() { | 666 String toString() { |
627 var superString = super.toString(); | 667 var superString = super.toString(); |
628 return "_SpeechRecognizerListenerProxyControl($superString)"; | 668 return "_SpeechRecognizerListenerProxyControl($superString)"; |
629 } | 669 } |
630 } | 670 } |
631 | 671 |
632 class SpeechRecognizerListenerProxy | 672 class SpeechRecognizerListenerProxy |
633 extends bindings.Proxy | 673 extends bindings.Proxy<SpeechRecognizerListener> |
634 implements SpeechRecognizerListener { | 674 implements SpeechRecognizerListener, |
| 675 SpeechRecognizerListenerInterface, |
| 676 SpeechRecognizerListenerInterfaceRequest { |
635 SpeechRecognizerListenerProxy.fromEndpoint( | 677 SpeechRecognizerListenerProxy.fromEndpoint( |
636 core.MojoMessagePipeEndpoint endpoint) | 678 core.MojoMessagePipeEndpoint endpoint) |
637 : super(new _SpeechRecognizerListenerProxyControl.fromEndpoint(endpoint)); | 679 : super(new _SpeechRecognizerListenerProxyControl.fromEndpoint(endpoint)); |
638 | 680 |
639 SpeechRecognizerListenerProxy.fromHandle(core.MojoHandle handle) | 681 SpeechRecognizerListenerProxy.fromHandle(core.MojoHandle handle) |
640 : super(new _SpeechRecognizerListenerProxyControl.fromHandle(handle)); | 682 : super(new _SpeechRecognizerListenerProxyControl.fromHandle(handle)); |
641 | 683 |
642 SpeechRecognizerListenerProxy.unbound() | 684 SpeechRecognizerListenerProxy.unbound() |
643 : super(new _SpeechRecognizerListenerProxyControl.unbound()); | 685 : super(new _SpeechRecognizerListenerProxyControl.unbound()); |
644 | 686 |
645 static SpeechRecognizerListenerProxy newFromEndpoint( | 687 static SpeechRecognizerListenerProxy newFromEndpoint( |
646 core.MojoMessagePipeEndpoint endpoint) { | 688 core.MojoMessagePipeEndpoint endpoint) { |
647 assert(endpoint.setDescription("For SpeechRecognizerListenerProxy")); | 689 assert(endpoint.setDescription("For SpeechRecognizerListenerProxy")); |
648 return new SpeechRecognizerListenerProxy.fromEndpoint(endpoint); | 690 return new SpeechRecognizerListenerProxy.fromEndpoint(endpoint); |
649 } | 691 } |
650 | 692 |
651 factory SpeechRecognizerListenerProxy.connectToService( | |
652 bindings.ServiceConnector s, String url, [String serviceName]) { | |
653 SpeechRecognizerListenerProxy p = new SpeechRecognizerListenerProxy.unbound(
); | |
654 s.connectToService(url, p, serviceName); | |
655 return p; | |
656 } | |
657 | |
658 | 693 |
659 void onRecognizerError(Error errorCode) { | 694 void onRecognizerError(Error errorCode) { |
660 if (!ctrl.isBound) { | 695 if (!ctrl.isBound) { |
661 ctrl.proxyError("The Proxy is closed."); | 696 ctrl.proxyError("The Proxy is closed."); |
662 return; | 697 return; |
663 } | 698 } |
664 var params = new _SpeechRecognizerListenerOnRecognizerErrorParams(); | 699 var params = new _SpeechRecognizerListenerOnRecognizerErrorParams(); |
665 params.errorCode = errorCode; | 700 params.errorCode = errorCode; |
666 ctrl.sendMessage(params, | 701 ctrl.sendMessage(params, |
667 _speechRecognizerListenerMethodOnRecognizerErrorName); | 702 _speechRecognizerListenerMethodOnRecognizerErrorName); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 } | 736 } |
702 | 737 |
703 _SpeechRecognizerListenerStubControl.fromHandle( | 738 _SpeechRecognizerListenerStubControl.fromHandle( |
704 core.MojoHandle handle, [SpeechRecognizerListener impl]) | 739 core.MojoHandle handle, [SpeechRecognizerListener impl]) |
705 : super.fromHandle(handle, autoBegin: impl != null) { | 740 : super.fromHandle(handle, autoBegin: impl != null) { |
706 _impl = impl; | 741 _impl = impl; |
707 } | 742 } |
708 | 743 |
709 _SpeechRecognizerListenerStubControl.unbound([this._impl]) : super.unbound(); | 744 _SpeechRecognizerListenerStubControl.unbound([this._impl]) : super.unbound(); |
710 | 745 |
| 746 String get serviceName => SpeechRecognizerListener.serviceName; |
| 747 |
711 | 748 |
712 | 749 |
713 dynamic handleMessage(bindings.ServiceMessage message) { | 750 dynamic handleMessage(bindings.ServiceMessage message) { |
714 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 751 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
715 return bindings.ControlMessageHandler.handleMessage(this, | 752 return bindings.ControlMessageHandler.handleMessage(this, |
716 0, | 753 0, |
717 message); | 754 message); |
718 } | 755 } |
719 if (_impl == null) { | 756 if (_impl == null) { |
720 throw new core.MojoApiError("$this has no implementation set"); | 757 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 } | 798 } |
762 } | 799 } |
763 | 800 |
764 @override | 801 @override |
765 String toString() { | 802 String toString() { |
766 var superString = super.toString(); | 803 var superString = super.toString(); |
767 return "_SpeechRecognizerListenerStubControl($superString)"; | 804 return "_SpeechRecognizerListenerStubControl($superString)"; |
768 } | 805 } |
769 | 806 |
770 int get version => 0; | 807 int get version => 0; |
771 | |
772 static service_describer.ServiceDescription _cachedServiceDescription; | |
773 static service_describer.ServiceDescription get serviceDescription { | |
774 if (_cachedServiceDescription == null) { | |
775 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio
n(); | |
776 } | |
777 return _cachedServiceDescription; | |
778 } | |
779 } | 808 } |
780 | 809 |
781 class SpeechRecognizerListenerStub | 810 class SpeechRecognizerListenerStub |
782 extends bindings.Stub<SpeechRecognizerListener> | 811 extends bindings.Stub<SpeechRecognizerListener> |
783 implements SpeechRecognizerListener { | 812 implements SpeechRecognizerListener, |
| 813 SpeechRecognizerListenerInterface, |
| 814 SpeechRecognizerListenerInterfaceRequest { |
| 815 SpeechRecognizerListenerStub.unbound([SpeechRecognizerListener impl]) |
| 816 : super(new _SpeechRecognizerListenerStubControl.unbound(impl)); |
| 817 |
784 SpeechRecognizerListenerStub.fromEndpoint( | 818 SpeechRecognizerListenerStub.fromEndpoint( |
785 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl]) | 819 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl]) |
786 : super(new _SpeechRecognizerListenerStubControl.fromEndpoint(endpoint, im
pl)); | 820 : super(new _SpeechRecognizerListenerStubControl.fromEndpoint(endpoint, im
pl)); |
787 | 821 |
788 SpeechRecognizerListenerStub.fromHandle( | 822 SpeechRecognizerListenerStub.fromHandle( |
789 core.MojoHandle handle, [SpeechRecognizerListener impl]) | 823 core.MojoHandle handle, [SpeechRecognizerListener impl]) |
790 : super(new _SpeechRecognizerListenerStubControl.fromHandle(handle, impl))
; | 824 : super(new _SpeechRecognizerListenerStubControl.fromHandle(handle, impl))
; |
791 | 825 |
792 SpeechRecognizerListenerStub.unbound([SpeechRecognizerListener impl]) | |
793 : super(new _SpeechRecognizerListenerStubControl.unbound(impl)); | |
794 | |
795 static SpeechRecognizerListenerStub newFromEndpoint( | 826 static SpeechRecognizerListenerStub newFromEndpoint( |
796 core.MojoMessagePipeEndpoint endpoint) { | 827 core.MojoMessagePipeEndpoint endpoint) { |
797 assert(endpoint.setDescription("For SpeechRecognizerListenerStub")); | 828 assert(endpoint.setDescription("For SpeechRecognizerListenerStub")); |
798 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint); | 829 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint); |
799 } | 830 } |
800 | 831 |
801 static service_describer.ServiceDescription get serviceDescription => | |
802 _SpeechRecognizerListenerStubControl.serviceDescription; | |
803 | |
804 | 832 |
805 void onRecognizerError(Error errorCode) { | 833 void onRecognizerError(Error errorCode) { |
806 return impl.onRecognizerError(errorCode); | 834 return impl.onRecognizerError(errorCode); |
807 } | 835 } |
808 void onResults(List<UtteranceCandidate> results, bool complete) { | 836 void onResults(List<UtteranceCandidate> results, bool complete) { |
809 return impl.onResults(results, complete); | 837 return impl.onResults(results, complete); |
810 } | 838 } |
811 void onSoundLevelChanged(double rmsDb) { | 839 void onSoundLevelChanged(double rmsDb) { |
812 return impl.onSoundLevelChanged(rmsDb); | 840 return impl.onSoundLevelChanged(rmsDb); |
813 } | 841 } |
814 } | 842 } |
815 | 843 |
816 const int _speechRecognizerServiceMethodListenName = 0; | 844 const int _speechRecognizerServiceMethodListenName = 0; |
817 const int _speechRecognizerServiceMethodStopListeningName = 1; | 845 const int _speechRecognizerServiceMethodStopListeningName = 1; |
818 | 846 |
819 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se
rviceDescription { | 847 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se
rviceDescription { |
820 dynamic getTopLevelInterface([Function responseFactory]) => | 848 dynamic getTopLevelInterface([Function responseFactory]) => |
821 responseFactory(null); | 849 responseFactory(null); |
822 | 850 |
823 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 851 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
824 responseFactory(null); | 852 responseFactory(null); |
825 | 853 |
826 dynamic getAllTypeDefinitions([Function responseFactory]) => | 854 dynamic getAllTypeDefinitions([Function responseFactory]) => |
827 responseFactory(null); | 855 responseFactory(null); |
828 } | 856 } |
829 | 857 |
830 abstract class SpeechRecognizerService { | 858 abstract class SpeechRecognizerService { |
831 static const String serviceName = "speech_recognizer::SpeechRecognizerService"
; | 859 static const String serviceName = "speech_recognizer::SpeechRecognizerService"
; |
832 void listen(Object listener); | 860 |
| 861 static service_describer.ServiceDescription _cachedServiceDescription; |
| 862 static service_describer.ServiceDescription get serviceDescription { |
| 863 if (_cachedServiceDescription == null) { |
| 864 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription
(); |
| 865 } |
| 866 return _cachedServiceDescription; |
| 867 } |
| 868 |
| 869 static SpeechRecognizerServiceProxy connectToService( |
| 870 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 871 SpeechRecognizerServiceProxy p = new SpeechRecognizerServiceProxy.unbound(); |
| 872 String name = serviceName ?? SpeechRecognizerService.serviceName; |
| 873 if ((name == null) || name.isEmpty) { |
| 874 throw new core.MojoApiError( |
| 875 "If an interface has no ServiceName, then one must be provided."); |
| 876 } |
| 877 s.connectToService(url, p, name); |
| 878 return p; |
| 879 } |
| 880 void listen(SpeechRecognizerListenerInterface listener); |
833 void stopListening(); | 881 void stopListening(); |
834 } | 882 } |
835 | 883 |
| 884 abstract class SpeechRecognizerServiceInterface |
| 885 implements bindings.MojoInterface<SpeechRecognizerService>, |
| 886 SpeechRecognizerService { |
| 887 factory SpeechRecognizerServiceInterface([SpeechRecognizerService impl]) => |
| 888 new SpeechRecognizerServiceStub.unbound(impl); |
| 889 factory SpeechRecognizerServiceInterface.fromEndpoint( |
| 890 core.MojoMessagePipeEndpoint endpoint, |
| 891 [SpeechRecognizerService impl]) => |
| 892 new SpeechRecognizerServiceStub.fromEndpoint(endpoint, impl); |
| 893 } |
| 894 |
| 895 abstract class SpeechRecognizerServiceInterfaceRequest |
| 896 implements bindings.MojoInterface<SpeechRecognizerService>, |
| 897 SpeechRecognizerService { |
| 898 factory SpeechRecognizerServiceInterfaceRequest() => |
| 899 new SpeechRecognizerServiceProxy.unbound(); |
| 900 } |
| 901 |
836 class _SpeechRecognizerServiceProxyControl | 902 class _SpeechRecognizerServiceProxyControl |
837 extends bindings.ProxyMessageHandler | 903 extends bindings.ProxyMessageHandler |
838 implements bindings.ProxyControl { | 904 implements bindings.ProxyControl<SpeechRecognizerService> { |
839 _SpeechRecognizerServiceProxyControl.fromEndpoint( | 905 _SpeechRecognizerServiceProxyControl.fromEndpoint( |
840 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 906 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
841 | 907 |
842 _SpeechRecognizerServiceProxyControl.fromHandle( | 908 _SpeechRecognizerServiceProxyControl.fromHandle( |
843 core.MojoHandle handle) : super.fromHandle(handle); | 909 core.MojoHandle handle) : super.fromHandle(handle); |
844 | 910 |
845 _SpeechRecognizerServiceProxyControl.unbound() : super.unbound(); | 911 _SpeechRecognizerServiceProxyControl.unbound() : super.unbound(); |
846 | 912 |
847 service_describer.ServiceDescription get serviceDescription => | |
848 new _SpeechRecognizerServiceServiceDescription(); | |
849 | |
850 String get serviceName => SpeechRecognizerService.serviceName; | 913 String get serviceName => SpeechRecognizerService.serviceName; |
851 | 914 |
852 void handleResponse(bindings.ServiceMessage message) { | 915 void handleResponse(bindings.ServiceMessage message) { |
853 switch (message.header.type) { | 916 switch (message.header.type) { |
854 default: | 917 default: |
855 proxyError("Unexpected message type: ${message.header.type}"); | 918 proxyError("Unexpected message type: ${message.header.type}"); |
856 close(immediate: true); | 919 close(immediate: true); |
857 break; | 920 break; |
858 } | 921 } |
859 } | 922 } |
860 | 923 |
| 924 SpeechRecognizerService get impl => null; |
| 925 set impl(SpeechRecognizerService _) { |
| 926 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 927 } |
| 928 |
861 @override | 929 @override |
862 String toString() { | 930 String toString() { |
863 var superString = super.toString(); | 931 var superString = super.toString(); |
864 return "_SpeechRecognizerServiceProxyControl($superString)"; | 932 return "_SpeechRecognizerServiceProxyControl($superString)"; |
865 } | 933 } |
866 } | 934 } |
867 | 935 |
868 class SpeechRecognizerServiceProxy | 936 class SpeechRecognizerServiceProxy |
869 extends bindings.Proxy | 937 extends bindings.Proxy<SpeechRecognizerService> |
870 implements SpeechRecognizerService { | 938 implements SpeechRecognizerService, |
| 939 SpeechRecognizerServiceInterface, |
| 940 SpeechRecognizerServiceInterfaceRequest { |
871 SpeechRecognizerServiceProxy.fromEndpoint( | 941 SpeechRecognizerServiceProxy.fromEndpoint( |
872 core.MojoMessagePipeEndpoint endpoint) | 942 core.MojoMessagePipeEndpoint endpoint) |
873 : super(new _SpeechRecognizerServiceProxyControl.fromEndpoint(endpoint)); | 943 : super(new _SpeechRecognizerServiceProxyControl.fromEndpoint(endpoint)); |
874 | 944 |
875 SpeechRecognizerServiceProxy.fromHandle(core.MojoHandle handle) | 945 SpeechRecognizerServiceProxy.fromHandle(core.MojoHandle handle) |
876 : super(new _SpeechRecognizerServiceProxyControl.fromHandle(handle)); | 946 : super(new _SpeechRecognizerServiceProxyControl.fromHandle(handle)); |
877 | 947 |
878 SpeechRecognizerServiceProxy.unbound() | 948 SpeechRecognizerServiceProxy.unbound() |
879 : super(new _SpeechRecognizerServiceProxyControl.unbound()); | 949 : super(new _SpeechRecognizerServiceProxyControl.unbound()); |
880 | 950 |
881 static SpeechRecognizerServiceProxy newFromEndpoint( | 951 static SpeechRecognizerServiceProxy newFromEndpoint( |
882 core.MojoMessagePipeEndpoint endpoint) { | 952 core.MojoMessagePipeEndpoint endpoint) { |
883 assert(endpoint.setDescription("For SpeechRecognizerServiceProxy")); | 953 assert(endpoint.setDescription("For SpeechRecognizerServiceProxy")); |
884 return new SpeechRecognizerServiceProxy.fromEndpoint(endpoint); | 954 return new SpeechRecognizerServiceProxy.fromEndpoint(endpoint); |
885 } | 955 } |
886 | 956 |
887 factory SpeechRecognizerServiceProxy.connectToService( | |
888 bindings.ServiceConnector s, String url, [String serviceName]) { | |
889 SpeechRecognizerServiceProxy p = new SpeechRecognizerServiceProxy.unbound(); | |
890 s.connectToService(url, p, serviceName); | |
891 return p; | |
892 } | |
893 | 957 |
894 | 958 void listen(SpeechRecognizerListenerInterface listener) { |
895 void listen(Object listener) { | |
896 if (!ctrl.isBound) { | 959 if (!ctrl.isBound) { |
897 ctrl.proxyError("The Proxy is closed."); | 960 ctrl.proxyError("The Proxy is closed."); |
898 return; | 961 return; |
899 } | 962 } |
900 var params = new _SpeechRecognizerServiceListenParams(); | 963 var params = new _SpeechRecognizerServiceListenParams(); |
901 params.listener = listener; | 964 params.listener = listener; |
902 ctrl.sendMessage(params, | 965 ctrl.sendMessage(params, |
903 _speechRecognizerServiceMethodListenName); | 966 _speechRecognizerServiceMethodListenName); |
904 } | 967 } |
905 void stopListening() { | 968 void stopListening() { |
(...skipping 19 matching lines...) Expand all Loading... |
925 } | 988 } |
926 | 989 |
927 _SpeechRecognizerServiceStubControl.fromHandle( | 990 _SpeechRecognizerServiceStubControl.fromHandle( |
928 core.MojoHandle handle, [SpeechRecognizerService impl]) | 991 core.MojoHandle handle, [SpeechRecognizerService impl]) |
929 : super.fromHandle(handle, autoBegin: impl != null) { | 992 : super.fromHandle(handle, autoBegin: impl != null) { |
930 _impl = impl; | 993 _impl = impl; |
931 } | 994 } |
932 | 995 |
933 _SpeechRecognizerServiceStubControl.unbound([this._impl]) : super.unbound(); | 996 _SpeechRecognizerServiceStubControl.unbound([this._impl]) : super.unbound(); |
934 | 997 |
| 998 String get serviceName => SpeechRecognizerService.serviceName; |
| 999 |
935 | 1000 |
936 | 1001 |
937 dynamic handleMessage(bindings.ServiceMessage message) { | 1002 dynamic handleMessage(bindings.ServiceMessage message) { |
938 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1003 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
939 return bindings.ControlMessageHandler.handleMessage(this, | 1004 return bindings.ControlMessageHandler.handleMessage(this, |
940 0, | 1005 0, |
941 message); | 1006 message); |
942 } | 1007 } |
943 if (_impl == null) { | 1008 if (_impl == null) { |
944 throw new core.MojoApiError("$this has no implementation set"); | 1009 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 } | 1043 } |
979 } | 1044 } |
980 | 1045 |
981 @override | 1046 @override |
982 String toString() { | 1047 String toString() { |
983 var superString = super.toString(); | 1048 var superString = super.toString(); |
984 return "_SpeechRecognizerServiceStubControl($superString)"; | 1049 return "_SpeechRecognizerServiceStubControl($superString)"; |
985 } | 1050 } |
986 | 1051 |
987 int get version => 0; | 1052 int get version => 0; |
988 | |
989 static service_describer.ServiceDescription _cachedServiceDescription; | |
990 static service_describer.ServiceDescription get serviceDescription { | |
991 if (_cachedServiceDescription == null) { | |
992 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription
(); | |
993 } | |
994 return _cachedServiceDescription; | |
995 } | |
996 } | 1053 } |
997 | 1054 |
998 class SpeechRecognizerServiceStub | 1055 class SpeechRecognizerServiceStub |
999 extends bindings.Stub<SpeechRecognizerService> | 1056 extends bindings.Stub<SpeechRecognizerService> |
1000 implements SpeechRecognizerService { | 1057 implements SpeechRecognizerService, |
| 1058 SpeechRecognizerServiceInterface, |
| 1059 SpeechRecognizerServiceInterfaceRequest { |
| 1060 SpeechRecognizerServiceStub.unbound([SpeechRecognizerService impl]) |
| 1061 : super(new _SpeechRecognizerServiceStubControl.unbound(impl)); |
| 1062 |
1001 SpeechRecognizerServiceStub.fromEndpoint( | 1063 SpeechRecognizerServiceStub.fromEndpoint( |
1002 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl]) | 1064 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl]) |
1003 : super(new _SpeechRecognizerServiceStubControl.fromEndpoint(endpoint, imp
l)); | 1065 : super(new _SpeechRecognizerServiceStubControl.fromEndpoint(endpoint, imp
l)); |
1004 | 1066 |
1005 SpeechRecognizerServiceStub.fromHandle( | 1067 SpeechRecognizerServiceStub.fromHandle( |
1006 core.MojoHandle handle, [SpeechRecognizerService impl]) | 1068 core.MojoHandle handle, [SpeechRecognizerService impl]) |
1007 : super(new _SpeechRecognizerServiceStubControl.fromHandle(handle, impl)); | 1069 : super(new _SpeechRecognizerServiceStubControl.fromHandle(handle, impl)); |
1008 | 1070 |
1009 SpeechRecognizerServiceStub.unbound([SpeechRecognizerService impl]) | |
1010 : super(new _SpeechRecognizerServiceStubControl.unbound(impl)); | |
1011 | |
1012 static SpeechRecognizerServiceStub newFromEndpoint( | 1071 static SpeechRecognizerServiceStub newFromEndpoint( |
1013 core.MojoMessagePipeEndpoint endpoint) { | 1072 core.MojoMessagePipeEndpoint endpoint) { |
1014 assert(endpoint.setDescription("For SpeechRecognizerServiceStub")); | 1073 assert(endpoint.setDescription("For SpeechRecognizerServiceStub")); |
1015 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint); | 1074 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint); |
1016 } | 1075 } |
1017 | 1076 |
1018 static service_describer.ServiceDescription get serviceDescription => | |
1019 _SpeechRecognizerServiceStubControl.serviceDescription; | |
1020 | 1077 |
1021 | 1078 void listen(SpeechRecognizerListenerInterface listener) { |
1022 void listen(Object listener) { | |
1023 return impl.listen(listener); | 1079 return impl.listen(listener); |
1024 } | 1080 } |
1025 void stopListening() { | 1081 void stopListening() { |
1026 return impl.stopListening(); | 1082 return impl.stopListening(); |
1027 } | 1083 } |
1028 } | 1084 } |
1029 | 1085 |
1030 | 1086 |
1031 | 1087 |
OLD | NEW |