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

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

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 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 // 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void onRecognizerError(Error errorCode); 595 void onRecognizerError(Error errorCode);
596 void onResults(List<UtteranceCandidate> results, bool complete); 596 void onResults(List<UtteranceCandidate> results, bool complete);
597 void onSoundLevelChanged(double rmsDb); 597 void onSoundLevelChanged(double rmsDb);
598 } 598 }
599 599
600 600 class _SpeechRecognizerListenerProxyControl
601 class _SpeechRecognizerListenerProxyControl extends bindings.ProxyMessageHandler 601 extends bindings.ProxyMessageHandler
602 implements bindings.ProxyControl { 602 implements bindings.ProxyControl {
603 _SpeechRecognizerListenerProxyControl.fromEndpoint( 603 _SpeechRecognizerListenerProxyControl.fromEndpoint(
604 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 604 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
605 605
606 _SpeechRecognizerListenerProxyControl.fromHandle( 606 _SpeechRecognizerListenerProxyControl.fromHandle(
607 core.MojoHandle handle) : super.fromHandle(handle); 607 core.MojoHandle handle) : super.fromHandle(handle);
608 608
609 _SpeechRecognizerListenerProxyControl.unbound() : super.unbound(); 609 _SpeechRecognizerListenerProxyControl.unbound() : super.unbound();
610 610
611 service_describer.ServiceDescription get serviceDescription => 611 service_describer.ServiceDescription get serviceDescription =>
612 new _SpeechRecognizerListenerServiceDescription(); 612 new _SpeechRecognizerListenerServiceDescription();
613 613
614 String get serviceName => SpeechRecognizerListener.serviceName; 614 String get serviceName => SpeechRecognizerListener.serviceName;
615 615
616 @override
617 void handleResponse(bindings.ServiceMessage message) { 616 void handleResponse(bindings.ServiceMessage message) {
618 switch (message.header.type) { 617 switch (message.header.type) {
619 default: 618 default:
620 proxyError("Unexpected message type: ${message.header.type}"); 619 proxyError("Unexpected message type: ${message.header.type}");
621 close(immediate: true); 620 close(immediate: true);
622 break; 621 break;
623 } 622 }
624 } 623 }
625 624
626 @override 625 @override
627 String toString() { 626 String toString() {
628 var superString = super.toString(); 627 var superString = super.toString();
629 return "_SpeechRecognizerListenerProxyControl($superString)"; 628 return "_SpeechRecognizerListenerProxyControl($superString)";
630 } 629 }
631 } 630 }
632 631
633 632 class SpeechRecognizerListenerProxy
634 class SpeechRecognizerListenerProxy extends bindings.Proxy 633 extends bindings.Proxy
635 implements SpeechRecognizerListener { 634 implements SpeechRecognizerListener {
636 SpeechRecognizerListenerProxy.fromEndpoint( 635 SpeechRecognizerListenerProxy.fromEndpoint(
637 core.MojoMessagePipeEndpoint endpoint) 636 core.MojoMessagePipeEndpoint endpoint)
638 : super(new _SpeechRecognizerListenerProxyControl.fromEndpoint(endpoint)); 637 : super(new _SpeechRecognizerListenerProxyControl.fromEndpoint(endpoint));
639 638
640 SpeechRecognizerListenerProxy.fromHandle(core.MojoHandle handle) 639 SpeechRecognizerListenerProxy.fromHandle(core.MojoHandle handle)
641 : super(new _SpeechRecognizerListenerProxyControl.fromHandle(handle)); 640 : super(new _SpeechRecognizerListenerProxyControl.fromHandle(handle));
642 641
643 SpeechRecognizerListenerProxy.unbound() 642 SpeechRecognizerListenerProxy.unbound()
644 : super(new _SpeechRecognizerListenerProxyControl.unbound()); 643 : super(new _SpeechRecognizerListenerProxyControl.unbound());
645 644
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 ctrl.proxyError("The Proxy is closed."); 682 ctrl.proxyError("The Proxy is closed.");
684 return; 683 return;
685 } 684 }
686 var params = new _SpeechRecognizerListenerOnSoundLevelChangedParams(); 685 var params = new _SpeechRecognizerListenerOnSoundLevelChangedParams();
687 params.rmsDb = rmsDb; 686 params.rmsDb = rmsDb;
688 ctrl.sendMessage(params, 687 ctrl.sendMessage(params,
689 _speechRecognizerListenerMethodOnSoundLevelChangedName); 688 _speechRecognizerListenerMethodOnSoundLevelChangedName);
690 } 689 }
691 } 690 }
692 691
693 692 class _SpeechRecognizerListenerStubControl
694 class SpeechRecognizerListenerStub extends bindings.Stub { 693 extends bindings.StubMessageHandler
694 implements bindings.StubControl<SpeechRecognizerListener> {
695 SpeechRecognizerListener _impl; 695 SpeechRecognizerListener _impl;
696 696
697 SpeechRecognizerListenerStub.fromEndpoint( 697 _SpeechRecognizerListenerStubControl.fromEndpoint(
698 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl]) 698 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl])
699 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 699 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
700 _impl = impl; 700 _impl = impl;
701 } 701 }
702 702
703 SpeechRecognizerListenerStub.fromHandle( 703 _SpeechRecognizerListenerStubControl.fromHandle(
704 core.MojoHandle handle, [SpeechRecognizerListener impl]) 704 core.MojoHandle handle, [SpeechRecognizerListener impl])
705 : super.fromHandle(handle, autoBegin: impl != null) { 705 : super.fromHandle(handle, autoBegin: impl != null) {
706 _impl = impl; 706 _impl = impl;
707 } 707 }
708 708
709 SpeechRecognizerListenerStub.unbound([this._impl]) : super.unbound(); 709 _SpeechRecognizerListenerStubControl.unbound([this._impl]) : super.unbound();
710
711 static SpeechRecognizerListenerStub newFromEndpoint(
712 core.MojoMessagePipeEndpoint endpoint) {
713 assert(endpoint.setDescription("For SpeechRecognizerListenerStub"));
714 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint);
715 }
716 710
717 711
718 712
719 dynamic handleMessage(bindings.ServiceMessage message) { 713 dynamic handleMessage(bindings.ServiceMessage message) {
720 if (bindings.ControlMessageHandler.isControlMessage(message)) { 714 if (bindings.ControlMessageHandler.isControlMessage(message)) {
721 return bindings.ControlMessageHandler.handleMessage(this, 715 return bindings.ControlMessageHandler.handleMessage(this,
722 0, 716 0,
723 message); 717 message);
724 } 718 }
725 if (_impl == null) { 719 if (_impl == null) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 754 }
761 755
762 @override 756 @override
763 void bind(core.MojoMessagePipeEndpoint endpoint) { 757 void bind(core.MojoMessagePipeEndpoint endpoint) {
764 super.bind(endpoint); 758 super.bind(endpoint);
765 if (!isOpen && (_impl != null)) { 759 if (!isOpen && (_impl != null)) {
766 beginHandlingEvents(); 760 beginHandlingEvents();
767 } 761 }
768 } 762 }
769 763
764 @override
770 String toString() { 765 String toString() {
771 var superString = super.toString(); 766 var superString = super.toString();
772 return "SpeechRecognizerListenerStub($superString)"; 767 return "_SpeechRecognizerListenerStubControl($superString)";
773 } 768 }
774 769
775 int get version => 0; 770 int get version => 0;
776 771
777 static service_describer.ServiceDescription _cachedServiceDescription; 772 static service_describer.ServiceDescription _cachedServiceDescription;
778 static service_describer.ServiceDescription get serviceDescription { 773 static service_describer.ServiceDescription get serviceDescription {
779 if (_cachedServiceDescription == null) { 774 if (_cachedServiceDescription == null) {
780 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio n(); 775 _cachedServiceDescription = new _SpeechRecognizerListenerServiceDescriptio n();
781 } 776 }
782 return _cachedServiceDescription; 777 return _cachedServiceDescription;
783 } 778 }
784 } 779 }
785 780
781 class SpeechRecognizerListenerStub
782 extends bindings.Stub<SpeechRecognizerListener>
783 implements SpeechRecognizerListener {
784 SpeechRecognizerListenerStub.fromEndpoint(
785 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerListener impl])
786 : super(new _SpeechRecognizerListenerStubControl.fromEndpoint(endpoint, im pl));
787
788 SpeechRecognizerListenerStub.fromHandle(
789 core.MojoHandle handle, [SpeechRecognizerListener impl])
790 : super(new _SpeechRecognizerListenerStubControl.fromHandle(handle, impl)) ;
791
792 SpeechRecognizerListenerStub.unbound([SpeechRecognizerListener impl])
793 : super(new _SpeechRecognizerListenerStubControl.unbound(impl));
794
795 static SpeechRecognizerListenerStub newFromEndpoint(
796 core.MojoMessagePipeEndpoint endpoint) {
797 assert(endpoint.setDescription("For SpeechRecognizerListenerStub"));
798 return new SpeechRecognizerListenerStub.fromEndpoint(endpoint);
799 }
800
801 static service_describer.ServiceDescription get serviceDescription =>
802 _SpeechRecognizerListenerStubControl.serviceDescription;
803
804
805 void onRecognizerError(Error errorCode) {
806 return impl.onRecognizerError(errorCode);
807 }
808 void onResults(List<UtteranceCandidate> results, bool complete) {
809 return impl.onResults(results, complete);
810 }
811 void onSoundLevelChanged(double rmsDb) {
812 return impl.onSoundLevelChanged(rmsDb);
813 }
814 }
815
786 const int _speechRecognizerServiceMethodListenName = 0; 816 const int _speechRecognizerServiceMethodListenName = 0;
787 const int _speechRecognizerServiceMethodStopListeningName = 1; 817 const int _speechRecognizerServiceMethodStopListeningName = 1;
788 818
789 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se rviceDescription { 819 class _SpeechRecognizerServiceServiceDescription implements service_describer.Se rviceDescription {
790 dynamic getTopLevelInterface([Function responseFactory]) => 820 dynamic getTopLevelInterface([Function responseFactory]) =>
791 responseFactory(null); 821 responseFactory(null);
792 822
793 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 823 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
794 responseFactory(null); 824 responseFactory(null);
795 825
796 dynamic getAllTypeDefinitions([Function responseFactory]) => 826 dynamic getAllTypeDefinitions([Function responseFactory]) =>
797 responseFactory(null); 827 responseFactory(null);
798 } 828 }
799 829
800 abstract class SpeechRecognizerService { 830 abstract class SpeechRecognizerService {
801 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ; 831 static const String serviceName = "speech_recognizer::SpeechRecognizerService" ;
802 void listen(Object listener); 832 void listen(Object listener);
803 void stopListening(); 833 void stopListening();
804 } 834 }
805 835
806 836 class _SpeechRecognizerServiceProxyControl
807 class _SpeechRecognizerServiceProxyControl extends bindings.ProxyMessageHandler 837 extends bindings.ProxyMessageHandler
808 implements bindings.ProxyControl { 838 implements bindings.ProxyControl {
809 _SpeechRecognizerServiceProxyControl.fromEndpoint( 839 _SpeechRecognizerServiceProxyControl.fromEndpoint(
810 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 840 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
811 841
812 _SpeechRecognizerServiceProxyControl.fromHandle( 842 _SpeechRecognizerServiceProxyControl.fromHandle(
813 core.MojoHandle handle) : super.fromHandle(handle); 843 core.MojoHandle handle) : super.fromHandle(handle);
814 844
815 _SpeechRecognizerServiceProxyControl.unbound() : super.unbound(); 845 _SpeechRecognizerServiceProxyControl.unbound() : super.unbound();
816 846
817 service_describer.ServiceDescription get serviceDescription => 847 service_describer.ServiceDescription get serviceDescription =>
818 new _SpeechRecognizerServiceServiceDescription(); 848 new _SpeechRecognizerServiceServiceDescription();
819 849
820 String get serviceName => SpeechRecognizerService.serviceName; 850 String get serviceName => SpeechRecognizerService.serviceName;
821 851
822 @override
823 void handleResponse(bindings.ServiceMessage message) { 852 void handleResponse(bindings.ServiceMessage message) {
824 switch (message.header.type) { 853 switch (message.header.type) {
825 default: 854 default:
826 proxyError("Unexpected message type: ${message.header.type}"); 855 proxyError("Unexpected message type: ${message.header.type}");
827 close(immediate: true); 856 close(immediate: true);
828 break; 857 break;
829 } 858 }
830 } 859 }
831 860
832 @override 861 @override
833 String toString() { 862 String toString() {
834 var superString = super.toString(); 863 var superString = super.toString();
835 return "_SpeechRecognizerServiceProxyControl($superString)"; 864 return "_SpeechRecognizerServiceProxyControl($superString)";
836 } 865 }
837 } 866 }
838 867
839 868 class SpeechRecognizerServiceProxy
840 class SpeechRecognizerServiceProxy extends bindings.Proxy 869 extends bindings.Proxy
841 implements SpeechRecognizerService { 870 implements SpeechRecognizerService {
842 SpeechRecognizerServiceProxy.fromEndpoint( 871 SpeechRecognizerServiceProxy.fromEndpoint(
843 core.MojoMessagePipeEndpoint endpoint) 872 core.MojoMessagePipeEndpoint endpoint)
844 : super(new _SpeechRecognizerServiceProxyControl.fromEndpoint(endpoint)); 873 : super(new _SpeechRecognizerServiceProxyControl.fromEndpoint(endpoint));
845 874
846 SpeechRecognizerServiceProxy.fromHandle(core.MojoHandle handle) 875 SpeechRecognizerServiceProxy.fromHandle(core.MojoHandle handle)
847 : super(new _SpeechRecognizerServiceProxyControl.fromHandle(handle)); 876 : super(new _SpeechRecognizerServiceProxyControl.fromHandle(handle));
848 877
849 SpeechRecognizerServiceProxy.unbound() 878 SpeechRecognizerServiceProxy.unbound()
850 : super(new _SpeechRecognizerServiceProxyControl.unbound()); 879 : super(new _SpeechRecognizerServiceProxyControl.unbound());
851 880
(...skipping 25 matching lines...) Expand all
877 if (!ctrl.isBound) { 906 if (!ctrl.isBound) {
878 ctrl.proxyError("The Proxy is closed."); 907 ctrl.proxyError("The Proxy is closed.");
879 return; 908 return;
880 } 909 }
881 var params = new _SpeechRecognizerServiceStopListeningParams(); 910 var params = new _SpeechRecognizerServiceStopListeningParams();
882 ctrl.sendMessage(params, 911 ctrl.sendMessage(params,
883 _speechRecognizerServiceMethodStopListeningName); 912 _speechRecognizerServiceMethodStopListeningName);
884 } 913 }
885 } 914 }
886 915
887 916 class _SpeechRecognizerServiceStubControl
888 class SpeechRecognizerServiceStub extends bindings.Stub { 917 extends bindings.StubMessageHandler
918 implements bindings.StubControl<SpeechRecognizerService> {
889 SpeechRecognizerService _impl; 919 SpeechRecognizerService _impl;
890 920
891 SpeechRecognizerServiceStub.fromEndpoint( 921 _SpeechRecognizerServiceStubControl.fromEndpoint(
892 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl]) 922 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl])
893 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 923 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
894 _impl = impl; 924 _impl = impl;
895 } 925 }
896 926
897 SpeechRecognizerServiceStub.fromHandle( 927 _SpeechRecognizerServiceStubControl.fromHandle(
898 core.MojoHandle handle, [SpeechRecognizerService impl]) 928 core.MojoHandle handle, [SpeechRecognizerService impl])
899 : super.fromHandle(handle, autoBegin: impl != null) { 929 : super.fromHandle(handle, autoBegin: impl != null) {
900 _impl = impl; 930 _impl = impl;
901 } 931 }
902 932
903 SpeechRecognizerServiceStub.unbound([this._impl]) : super.unbound(); 933 _SpeechRecognizerServiceStubControl.unbound([this._impl]) : super.unbound();
904
905 static SpeechRecognizerServiceStub newFromEndpoint(
906 core.MojoMessagePipeEndpoint endpoint) {
907 assert(endpoint.setDescription("For SpeechRecognizerServiceStub"));
908 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint);
909 }
910 934
911 935
912 936
913 dynamic handleMessage(bindings.ServiceMessage message) { 937 dynamic handleMessage(bindings.ServiceMessage message) {
914 if (bindings.ControlMessageHandler.isControlMessage(message)) { 938 if (bindings.ControlMessageHandler.isControlMessage(message)) {
915 return bindings.ControlMessageHandler.handleMessage(this, 939 return bindings.ControlMessageHandler.handleMessage(this,
916 0, 940 0,
917 message); 941 message);
918 } 942 }
919 if (_impl == null) { 943 if (_impl == null) {
(...skipping 27 matching lines...) Expand all
947 } 971 }
948 972
949 @override 973 @override
950 void bind(core.MojoMessagePipeEndpoint endpoint) { 974 void bind(core.MojoMessagePipeEndpoint endpoint) {
951 super.bind(endpoint); 975 super.bind(endpoint);
952 if (!isOpen && (_impl != null)) { 976 if (!isOpen && (_impl != null)) {
953 beginHandlingEvents(); 977 beginHandlingEvents();
954 } 978 }
955 } 979 }
956 980
981 @override
957 String toString() { 982 String toString() {
958 var superString = super.toString(); 983 var superString = super.toString();
959 return "SpeechRecognizerServiceStub($superString)"; 984 return "_SpeechRecognizerServiceStubControl($superString)";
960 } 985 }
961 986
962 int get version => 0; 987 int get version => 0;
963 988
964 static service_describer.ServiceDescription _cachedServiceDescription; 989 static service_describer.ServiceDescription _cachedServiceDescription;
965 static service_describer.ServiceDescription get serviceDescription { 990 static service_describer.ServiceDescription get serviceDescription {
966 if (_cachedServiceDescription == null) { 991 if (_cachedServiceDescription == null) {
967 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription (); 992 _cachedServiceDescription = new _SpeechRecognizerServiceServiceDescription ();
968 } 993 }
969 return _cachedServiceDescription; 994 return _cachedServiceDescription;
970 } 995 }
971 } 996 }
972 997
998 class SpeechRecognizerServiceStub
999 extends bindings.Stub<SpeechRecognizerService>
1000 implements SpeechRecognizerService {
1001 SpeechRecognizerServiceStub.fromEndpoint(
1002 core.MojoMessagePipeEndpoint endpoint, [SpeechRecognizerService impl])
1003 : super(new _SpeechRecognizerServiceStubControl.fromEndpoint(endpoint, imp l));
1004
1005 SpeechRecognizerServiceStub.fromHandle(
1006 core.MojoHandle handle, [SpeechRecognizerService impl])
1007 : super(new _SpeechRecognizerServiceStubControl.fromHandle(handle, impl));
1008
1009 SpeechRecognizerServiceStub.unbound([SpeechRecognizerService impl])
1010 : super(new _SpeechRecognizerServiceStubControl.unbound(impl));
1011
1012 static SpeechRecognizerServiceStub newFromEndpoint(
1013 core.MojoMessagePipeEndpoint endpoint) {
1014 assert(endpoint.setDescription("For SpeechRecognizerServiceStub"));
1015 return new SpeechRecognizerServiceStub.fromEndpoint(endpoint);
1016 }
1017
1018 static service_describer.ServiceDescription get serviceDescription =>
1019 _SpeechRecognizerServiceStubControl.serviceDescription;
1020
1021
1022 void listen(Object listener) {
1023 return impl.listen(listener);
1024 }
1025 void stopListening() {
1026 return impl.stopListening();
1027 }
1028 }
1029
973 1030
974 1031
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698