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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/view_containers.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 view_containers_mojom; 5 library view_containers_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 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc ene_token_mojom; 10 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc ene_token_mojom;
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 717 }
718 718
719 abstract class ViewContainer { 719 abstract class ViewContainer {
720 static const String serviceName = null; 720 static const String serviceName = null;
721 void setListener(Object listener); 721 void setListener(Object listener);
722 void addChild(int childKey, Object childViewOwner); 722 void addChild(int childKey, Object childViewOwner);
723 void removeChild(int childKey, Object transferredViewOwner); 723 void removeChild(int childKey, Object transferredViewOwner);
724 void setChildProperties(int childKey, int childSceneVersion, view_properties_m ojom.ViewProperties childViewProperties); 724 void setChildProperties(int childKey, int childSceneVersion, view_properties_m ojom.ViewProperties childViewProperties);
725 } 725 }
726 726
727 727 class _ViewContainerProxyControl
728 class _ViewContainerProxyControl extends bindings.ProxyMessageHandler 728 extends bindings.ProxyMessageHandler
729 implements bindings.ProxyControl { 729 implements bindings.ProxyControl {
730 _ViewContainerProxyControl.fromEndpoint( 730 _ViewContainerProxyControl.fromEndpoint(
731 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 731 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
732 732
733 _ViewContainerProxyControl.fromHandle( 733 _ViewContainerProxyControl.fromHandle(
734 core.MojoHandle handle) : super.fromHandle(handle); 734 core.MojoHandle handle) : super.fromHandle(handle);
735 735
736 _ViewContainerProxyControl.unbound() : super.unbound(); 736 _ViewContainerProxyControl.unbound() : super.unbound();
737 737
738 service_describer.ServiceDescription get serviceDescription => 738 service_describer.ServiceDescription get serviceDescription =>
739 new _ViewContainerServiceDescription(); 739 new _ViewContainerServiceDescription();
740 740
741 String get serviceName => ViewContainer.serviceName; 741 String get serviceName => ViewContainer.serviceName;
742 742
743 @override
744 void handleResponse(bindings.ServiceMessage message) { 743 void handleResponse(bindings.ServiceMessage message) {
745 switch (message.header.type) { 744 switch (message.header.type) {
746 default: 745 default:
747 proxyError("Unexpected message type: ${message.header.type}"); 746 proxyError("Unexpected message type: ${message.header.type}");
748 close(immediate: true); 747 close(immediate: true);
749 break; 748 break;
750 } 749 }
751 } 750 }
752 751
753 @override 752 @override
754 String toString() { 753 String toString() {
755 var superString = super.toString(); 754 var superString = super.toString();
756 return "_ViewContainerProxyControl($superString)"; 755 return "_ViewContainerProxyControl($superString)";
757 } 756 }
758 } 757 }
759 758
760 759 class ViewContainerProxy
761 class ViewContainerProxy extends bindings.Proxy 760 extends bindings.Proxy
762 implements ViewContainer { 761 implements ViewContainer {
763 ViewContainerProxy.fromEndpoint( 762 ViewContainerProxy.fromEndpoint(
764 core.MojoMessagePipeEndpoint endpoint) 763 core.MojoMessagePipeEndpoint endpoint)
765 : super(new _ViewContainerProxyControl.fromEndpoint(endpoint)); 764 : super(new _ViewContainerProxyControl.fromEndpoint(endpoint));
766 765
767 ViewContainerProxy.fromHandle(core.MojoHandle handle) 766 ViewContainerProxy.fromHandle(core.MojoHandle handle)
768 : super(new _ViewContainerProxyControl.fromHandle(handle)); 767 : super(new _ViewContainerProxyControl.fromHandle(handle));
769 768
770 ViewContainerProxy.unbound() 769 ViewContainerProxy.unbound()
771 : super(new _ViewContainerProxyControl.unbound()); 770 : super(new _ViewContainerProxyControl.unbound());
772 771
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 822 }
824 var params = new _ViewContainerSetChildPropertiesParams(); 823 var params = new _ViewContainerSetChildPropertiesParams();
825 params.childKey = childKey; 824 params.childKey = childKey;
826 params.childSceneVersion = childSceneVersion; 825 params.childSceneVersion = childSceneVersion;
827 params.childViewProperties = childViewProperties; 826 params.childViewProperties = childViewProperties;
828 ctrl.sendMessage(params, 827 ctrl.sendMessage(params,
829 _viewContainerMethodSetChildPropertiesName); 828 _viewContainerMethodSetChildPropertiesName);
830 } 829 }
831 } 830 }
832 831
833 832 class _ViewContainerStubControl
834 class ViewContainerStub extends bindings.Stub { 833 extends bindings.StubMessageHandler
834 implements bindings.StubControl<ViewContainer> {
835 ViewContainer _impl; 835 ViewContainer _impl;
836 836
837 ViewContainerStub.fromEndpoint( 837 _ViewContainerStubControl.fromEndpoint(
838 core.MojoMessagePipeEndpoint endpoint, [ViewContainer impl]) 838 core.MojoMessagePipeEndpoint endpoint, [ViewContainer impl])
839 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 839 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
840 _impl = impl; 840 _impl = impl;
841 } 841 }
842 842
843 ViewContainerStub.fromHandle( 843 _ViewContainerStubControl.fromHandle(
844 core.MojoHandle handle, [ViewContainer impl]) 844 core.MojoHandle handle, [ViewContainer impl])
845 : super.fromHandle(handle, autoBegin: impl != null) { 845 : super.fromHandle(handle, autoBegin: impl != null) {
846 _impl = impl; 846 _impl = impl;
847 } 847 }
848 848
849 ViewContainerStub.unbound([this._impl]) : super.unbound(); 849 _ViewContainerStubControl.unbound([this._impl]) : super.unbound();
850
851 static ViewContainerStub newFromEndpoint(
852 core.MojoMessagePipeEndpoint endpoint) {
853 assert(endpoint.setDescription("For ViewContainerStub"));
854 return new ViewContainerStub.fromEndpoint(endpoint);
855 }
856 850
857 851
858 852
859 dynamic handleMessage(bindings.ServiceMessage message) { 853 dynamic handleMessage(bindings.ServiceMessage message) {
860 if (bindings.ControlMessageHandler.isControlMessage(message)) { 854 if (bindings.ControlMessageHandler.isControlMessage(message)) {
861 return bindings.ControlMessageHandler.handleMessage(this, 855 return bindings.ControlMessageHandler.handleMessage(this,
862 0, 856 0,
863 message); 857 message);
864 } 858 }
865 if (_impl == null) { 859 if (_impl == null) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 } 899 }
906 900
907 @override 901 @override
908 void bind(core.MojoMessagePipeEndpoint endpoint) { 902 void bind(core.MojoMessagePipeEndpoint endpoint) {
909 super.bind(endpoint); 903 super.bind(endpoint);
910 if (!isOpen && (_impl != null)) { 904 if (!isOpen && (_impl != null)) {
911 beginHandlingEvents(); 905 beginHandlingEvents();
912 } 906 }
913 } 907 }
914 908
909 @override
915 String toString() { 910 String toString() {
916 var superString = super.toString(); 911 var superString = super.toString();
917 return "ViewContainerStub($superString)"; 912 return "_ViewContainerStubControl($superString)";
918 } 913 }
919 914
920 int get version => 0; 915 int get version => 0;
921 916
922 static service_describer.ServiceDescription _cachedServiceDescription; 917 static service_describer.ServiceDescription _cachedServiceDescription;
923 static service_describer.ServiceDescription get serviceDescription { 918 static service_describer.ServiceDescription get serviceDescription {
924 if (_cachedServiceDescription == null) { 919 if (_cachedServiceDescription == null) {
925 _cachedServiceDescription = new _ViewContainerServiceDescription(); 920 _cachedServiceDescription = new _ViewContainerServiceDescription();
926 } 921 }
927 return _cachedServiceDescription; 922 return _cachedServiceDescription;
928 } 923 }
929 } 924 }
930 925
926 class ViewContainerStub
927 extends bindings.Stub<ViewContainer>
928 implements ViewContainer {
929 ViewContainerStub.fromEndpoint(
930 core.MojoMessagePipeEndpoint endpoint, [ViewContainer impl])
931 : super(new _ViewContainerStubControl.fromEndpoint(endpoint, impl));
932
933 ViewContainerStub.fromHandle(
934 core.MojoHandle handle, [ViewContainer impl])
935 : super(new _ViewContainerStubControl.fromHandle(handle, impl));
936
937 ViewContainerStub.unbound([ViewContainer impl])
938 : super(new _ViewContainerStubControl.unbound(impl));
939
940 static ViewContainerStub newFromEndpoint(
941 core.MojoMessagePipeEndpoint endpoint) {
942 assert(endpoint.setDescription("For ViewContainerStub"));
943 return new ViewContainerStub.fromEndpoint(endpoint);
944 }
945
946 static service_describer.ServiceDescription get serviceDescription =>
947 _ViewContainerStubControl.serviceDescription;
948
949
950 void setListener(Object listener) {
951 return impl.setListener(listener);
952 }
953 void addChild(int childKey, Object childViewOwner) {
954 return impl.addChild(childKey, childViewOwner);
955 }
956 void removeChild(int childKey, Object transferredViewOwner) {
957 return impl.removeChild(childKey, transferredViewOwner);
958 }
959 void setChildProperties(int childKey, int childSceneVersion, view_properties_m ojom.ViewProperties childViewProperties) {
960 return impl.setChildProperties(childKey, childSceneVersion, childViewPropert ies);
961 }
962 }
963
931 const int _viewContainerListenerMethodOnChildAttachedName = 0; 964 const int _viewContainerListenerMethodOnChildAttachedName = 0;
932 const int _viewContainerListenerMethodOnChildUnavailableName = 1; 965 const int _viewContainerListenerMethodOnChildUnavailableName = 1;
933 966
934 class _ViewContainerListenerServiceDescription implements service_describer.Serv iceDescription { 967 class _ViewContainerListenerServiceDescription implements service_describer.Serv iceDescription {
935 dynamic getTopLevelInterface([Function responseFactory]) => 968 dynamic getTopLevelInterface([Function responseFactory]) =>
936 responseFactory(null); 969 responseFactory(null);
937 970
938 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 971 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
939 responseFactory(null); 972 responseFactory(null);
940 973
941 dynamic getAllTypeDefinitions([Function responseFactory]) => 974 dynamic getAllTypeDefinitions([Function responseFactory]) =>
942 responseFactory(null); 975 responseFactory(null);
943 } 976 }
944 977
945 abstract class ViewContainerListener { 978 abstract class ViewContainerListener {
946 static const String serviceName = null; 979 static const String serviceName = null;
947 dynamic onChildAttached(int childKey,ViewInfo childViewInfo,[Function response Factory = null]); 980 dynamic onChildAttached(int childKey,ViewInfo childViewInfo,[Function response Factory = null]);
948 dynamic onChildUnavailable(int childKey,[Function responseFactory = null]); 981 dynamic onChildUnavailable(int childKey,[Function responseFactory = null]);
949 } 982 }
950 983
951 984 class _ViewContainerListenerProxyControl
952 class _ViewContainerListenerProxyControl extends bindings.ProxyMessageHandler 985 extends bindings.ProxyMessageHandler
953 implements bindings.ProxyControl { 986 implements bindings.ProxyControl {
954 _ViewContainerListenerProxyControl.fromEndpoint( 987 _ViewContainerListenerProxyControl.fromEndpoint(
955 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 988 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
956 989
957 _ViewContainerListenerProxyControl.fromHandle( 990 _ViewContainerListenerProxyControl.fromHandle(
958 core.MojoHandle handle) : super.fromHandle(handle); 991 core.MojoHandle handle) : super.fromHandle(handle);
959 992
960 _ViewContainerListenerProxyControl.unbound() : super.unbound(); 993 _ViewContainerListenerProxyControl.unbound() : super.unbound();
961 994
962 service_describer.ServiceDescription get serviceDescription => 995 service_describer.ServiceDescription get serviceDescription =>
963 new _ViewContainerListenerServiceDescription(); 996 new _ViewContainerListenerServiceDescription();
964 997
965 String get serviceName => ViewContainerListener.serviceName; 998 String get serviceName => ViewContainerListener.serviceName;
966 999
967 @override
968 void handleResponse(bindings.ServiceMessage message) { 1000 void handleResponse(bindings.ServiceMessage message) {
969 switch (message.header.type) { 1001 switch (message.header.type) {
970 case _viewContainerListenerMethodOnChildAttachedName: 1002 case _viewContainerListenerMethodOnChildAttachedName:
971 var r = ViewContainerListenerOnChildAttachedResponseParams.deserialize( 1003 var r = ViewContainerListenerOnChildAttachedResponseParams.deserialize(
972 message.payload); 1004 message.payload);
973 if (!message.header.hasRequestId) { 1005 if (!message.header.hasRequestId) {
974 proxyError("Expected a message with a valid request Id."); 1006 proxyError("Expected a message with a valid request Id.");
975 return; 1007 return;
976 } 1008 }
977 Completer c = completerMap[message.header.requestId]; 1009 Completer c = completerMap[message.header.requestId];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 } 1046 }
1015 } 1047 }
1016 1048
1017 @override 1049 @override
1018 String toString() { 1050 String toString() {
1019 var superString = super.toString(); 1051 var superString = super.toString();
1020 return "_ViewContainerListenerProxyControl($superString)"; 1052 return "_ViewContainerListenerProxyControl($superString)";
1021 } 1053 }
1022 } 1054 }
1023 1055
1024 1056 class ViewContainerListenerProxy
1025 class ViewContainerListenerProxy extends bindings.Proxy 1057 extends bindings.Proxy
1026 implements ViewContainerListener { 1058 implements ViewContainerListener {
1027 ViewContainerListenerProxy.fromEndpoint( 1059 ViewContainerListenerProxy.fromEndpoint(
1028 core.MojoMessagePipeEndpoint endpoint) 1060 core.MojoMessagePipeEndpoint endpoint)
1029 : super(new _ViewContainerListenerProxyControl.fromEndpoint(endpoint)); 1061 : super(new _ViewContainerListenerProxyControl.fromEndpoint(endpoint));
1030 1062
1031 ViewContainerListenerProxy.fromHandle(core.MojoHandle handle) 1063 ViewContainerListenerProxy.fromHandle(core.MojoHandle handle)
1032 : super(new _ViewContainerListenerProxyControl.fromHandle(handle)); 1064 : super(new _ViewContainerListenerProxyControl.fromHandle(handle));
1033 1065
1034 ViewContainerListenerProxy.unbound() 1066 ViewContainerListenerProxy.unbound()
1035 : super(new _ViewContainerListenerProxyControl.unbound()); 1067 : super(new _ViewContainerListenerProxyControl.unbound());
1036 1068
(...skipping 25 matching lines...) Expand all
1062 var params = new _ViewContainerListenerOnChildUnavailableParams(); 1094 var params = new _ViewContainerListenerOnChildUnavailableParams();
1063 params.childKey = childKey; 1095 params.childKey = childKey;
1064 return ctrl.sendMessageWithRequestId( 1096 return ctrl.sendMessageWithRequestId(
1065 params, 1097 params,
1066 _viewContainerListenerMethodOnChildUnavailableName, 1098 _viewContainerListenerMethodOnChildUnavailableName,
1067 -1, 1099 -1,
1068 bindings.MessageHeader.kMessageExpectsResponse); 1100 bindings.MessageHeader.kMessageExpectsResponse);
1069 } 1101 }
1070 } 1102 }
1071 1103
1072 1104 class _ViewContainerListenerStubControl
1073 class ViewContainerListenerStub extends bindings.Stub { 1105 extends bindings.StubMessageHandler
1106 implements bindings.StubControl<ViewContainerListener> {
1074 ViewContainerListener _impl; 1107 ViewContainerListener _impl;
1075 1108
1076 ViewContainerListenerStub.fromEndpoint( 1109 _ViewContainerListenerStubControl.fromEndpoint(
1077 core.MojoMessagePipeEndpoint endpoint, [ViewContainerListener impl]) 1110 core.MojoMessagePipeEndpoint endpoint, [ViewContainerListener impl])
1078 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1111 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1079 _impl = impl; 1112 _impl = impl;
1080 } 1113 }
1081 1114
1082 ViewContainerListenerStub.fromHandle( 1115 _ViewContainerListenerStubControl.fromHandle(
1083 core.MojoHandle handle, [ViewContainerListener impl]) 1116 core.MojoHandle handle, [ViewContainerListener impl])
1084 : super.fromHandle(handle, autoBegin: impl != null) { 1117 : super.fromHandle(handle, autoBegin: impl != null) {
1085 _impl = impl; 1118 _impl = impl;
1086 } 1119 }
1087 1120
1088 ViewContainerListenerStub.unbound([this._impl]) : super.unbound(); 1121 _ViewContainerListenerStubControl.unbound([this._impl]) : super.unbound();
1089
1090 static ViewContainerListenerStub newFromEndpoint(
1091 core.MojoMessagePipeEndpoint endpoint) {
1092 assert(endpoint.setDescription("For ViewContainerListenerStub"));
1093 return new ViewContainerListenerStub.fromEndpoint(endpoint);
1094 }
1095 1122
1096 1123
1097 ViewContainerListenerOnChildAttachedResponseParams _viewContainerListenerOnChi ldAttachedResponseParamsFactory() { 1124 ViewContainerListenerOnChildAttachedResponseParams _viewContainerListenerOnChi ldAttachedResponseParamsFactory() {
1098 var result = new ViewContainerListenerOnChildAttachedResponseParams(); 1125 var result = new ViewContainerListenerOnChildAttachedResponseParams();
1099 return result; 1126 return result;
1100 } 1127 }
1101 ViewContainerListenerOnChildUnavailableResponseParams _viewContainerListenerOn ChildUnavailableResponseParamsFactory() { 1128 ViewContainerListenerOnChildUnavailableResponseParams _viewContainerListenerOn ChildUnavailableResponseParamsFactory() {
1102 var result = new ViewContainerListenerOnChildUnavailableResponseParams(); 1129 var result = new ViewContainerListenerOnChildUnavailableResponseParams();
1103 return result; 1130 return result;
1104 } 1131 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 } 1203 }
1177 1204
1178 @override 1205 @override
1179 void bind(core.MojoMessagePipeEndpoint endpoint) { 1206 void bind(core.MojoMessagePipeEndpoint endpoint) {
1180 super.bind(endpoint); 1207 super.bind(endpoint);
1181 if (!isOpen && (_impl != null)) { 1208 if (!isOpen && (_impl != null)) {
1182 beginHandlingEvents(); 1209 beginHandlingEvents();
1183 } 1210 }
1184 } 1211 }
1185 1212
1213 @override
1186 String toString() { 1214 String toString() {
1187 var superString = super.toString(); 1215 var superString = super.toString();
1188 return "ViewContainerListenerStub($superString)"; 1216 return "_ViewContainerListenerStubControl($superString)";
1189 } 1217 }
1190 1218
1191 int get version => 0; 1219 int get version => 0;
1192 1220
1193 static service_describer.ServiceDescription _cachedServiceDescription; 1221 static service_describer.ServiceDescription _cachedServiceDescription;
1194 static service_describer.ServiceDescription get serviceDescription { 1222 static service_describer.ServiceDescription get serviceDescription {
1195 if (_cachedServiceDescription == null) { 1223 if (_cachedServiceDescription == null) {
1196 _cachedServiceDescription = new _ViewContainerListenerServiceDescription() ; 1224 _cachedServiceDescription = new _ViewContainerListenerServiceDescription() ;
1197 } 1225 }
1198 return _cachedServiceDescription; 1226 return _cachedServiceDescription;
1199 } 1227 }
1200 } 1228 }
1201 1229
1230 class ViewContainerListenerStub
1231 extends bindings.Stub<ViewContainerListener>
1232 implements ViewContainerListener {
1233 ViewContainerListenerStub.fromEndpoint(
1234 core.MojoMessagePipeEndpoint endpoint, [ViewContainerListener impl])
1235 : super(new _ViewContainerListenerStubControl.fromEndpoint(endpoint, impl) );
1236
1237 ViewContainerListenerStub.fromHandle(
1238 core.MojoHandle handle, [ViewContainerListener impl])
1239 : super(new _ViewContainerListenerStubControl.fromHandle(handle, impl));
1240
1241 ViewContainerListenerStub.unbound([ViewContainerListener impl])
1242 : super(new _ViewContainerListenerStubControl.unbound(impl));
1243
1244 static ViewContainerListenerStub newFromEndpoint(
1245 core.MojoMessagePipeEndpoint endpoint) {
1246 assert(endpoint.setDescription("For ViewContainerListenerStub"));
1247 return new ViewContainerListenerStub.fromEndpoint(endpoint);
1248 }
1249
1250 static service_describer.ServiceDescription get serviceDescription =>
1251 _ViewContainerListenerStubControl.serviceDescription;
1252
1253
1254 dynamic onChildAttached(int childKey,ViewInfo childViewInfo,[Function response Factory = null]) {
1255 return impl.onChildAttached(childKey,childViewInfo,responseFactory);
1256 }
1257 dynamic onChildUnavailable(int childKey,[Function responseFactory = null]) {
1258 return impl.onChildUnavailable(childKey,responseFactory);
1259 }
1260 }
1261
1202 1262
1203 1263
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698