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 contacts_mojom; | 5 library contacts_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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 755 |
756 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 756 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
757 responseFactory(null); | 757 responseFactory(null); |
758 | 758 |
759 dynamic getAllTypeDefinitions([Function responseFactory]) => | 759 dynamic getAllTypeDefinitions([Function responseFactory]) => |
760 responseFactory(null); | 760 responseFactory(null); |
761 } | 761 } |
762 | 762 |
763 abstract class ContactsService { | 763 abstract class ContactsService { |
764 static const String serviceName = "contacts::ContactsService"; | 764 static const String serviceName = "contacts::ContactsService"; |
| 765 |
| 766 static service_describer.ServiceDescription _cachedServiceDescription; |
| 767 static service_describer.ServiceDescription get serviceDescription { |
| 768 if (_cachedServiceDescription == null) { |
| 769 _cachedServiceDescription = new _ContactsServiceServiceDescription(); |
| 770 } |
| 771 return _cachedServiceDescription; |
| 772 } |
| 773 |
| 774 static ContactsServiceProxy connectToService( |
| 775 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 776 ContactsServiceProxy p = new ContactsServiceProxy.unbound(); |
| 777 String name = serviceName ?? ContactsService.serviceName; |
| 778 if ((name == null) || name.isEmpty) { |
| 779 throw new core.MojoApiError( |
| 780 "If an interface has no ServiceName, then one must be provided."); |
| 781 } |
| 782 s.connectToService(url, p, name); |
| 783 return p; |
| 784 } |
765 dynamic getCount(String filter,[Function responseFactory = null]); | 785 dynamic getCount(String filter,[Function responseFactory = null]); |
766 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]); | 786 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]); |
767 dynamic getEmails(int id,[Function responseFactory = null]); | 787 dynamic getEmails(int id,[Function responseFactory = null]); |
768 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
; | 788 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
; |
769 } | 789 } |
770 | 790 |
| 791 abstract class ContactsServiceInterface |
| 792 implements bindings.MojoInterface<ContactsService>, |
| 793 ContactsService { |
| 794 factory ContactsServiceInterface([ContactsService impl]) => |
| 795 new ContactsServiceStub.unbound(impl); |
| 796 factory ContactsServiceInterface.fromEndpoint( |
| 797 core.MojoMessagePipeEndpoint endpoint, |
| 798 [ContactsService impl]) => |
| 799 new ContactsServiceStub.fromEndpoint(endpoint, impl); |
| 800 } |
| 801 |
| 802 abstract class ContactsServiceInterfaceRequest |
| 803 implements bindings.MojoInterface<ContactsService>, |
| 804 ContactsService { |
| 805 factory ContactsServiceInterfaceRequest() => |
| 806 new ContactsServiceProxy.unbound(); |
| 807 } |
| 808 |
771 class _ContactsServiceProxyControl | 809 class _ContactsServiceProxyControl |
772 extends bindings.ProxyMessageHandler | 810 extends bindings.ProxyMessageHandler |
773 implements bindings.ProxyControl { | 811 implements bindings.ProxyControl<ContactsService> { |
774 _ContactsServiceProxyControl.fromEndpoint( | 812 _ContactsServiceProxyControl.fromEndpoint( |
775 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 813 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
776 | 814 |
777 _ContactsServiceProxyControl.fromHandle( | 815 _ContactsServiceProxyControl.fromHandle( |
778 core.MojoHandle handle) : super.fromHandle(handle); | 816 core.MojoHandle handle) : super.fromHandle(handle); |
779 | 817 |
780 _ContactsServiceProxyControl.unbound() : super.unbound(); | 818 _ContactsServiceProxyControl.unbound() : super.unbound(); |
781 | 819 |
782 service_describer.ServiceDescription get serviceDescription => | |
783 new _ContactsServiceServiceDescription(); | |
784 | |
785 String get serviceName => ContactsService.serviceName; | 820 String get serviceName => ContactsService.serviceName; |
786 | 821 |
787 void handleResponse(bindings.ServiceMessage message) { | 822 void handleResponse(bindings.ServiceMessage message) { |
788 switch (message.header.type) { | 823 switch (message.header.type) { |
789 case _contactsServiceMethodGetCountName: | 824 case _contactsServiceMethodGetCountName: |
790 var r = ContactsServiceGetCountResponseParams.deserialize( | 825 var r = ContactsServiceGetCountResponseParams.deserialize( |
791 message.payload); | 826 message.payload); |
792 if (!message.header.hasRequestId) { | 827 if (!message.header.hasRequestId) { |
793 proxyError("Expected a message with a valid request Id."); | 828 proxyError("Expected a message with a valid request Id."); |
794 return; | 829 return; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 901 } |
867 c.complete(r); | 902 c.complete(r); |
868 break; | 903 break; |
869 default: | 904 default: |
870 proxyError("Unexpected message type: ${message.header.type}"); | 905 proxyError("Unexpected message type: ${message.header.type}"); |
871 close(immediate: true); | 906 close(immediate: true); |
872 break; | 907 break; |
873 } | 908 } |
874 } | 909 } |
875 | 910 |
| 911 ContactsService get impl => null; |
| 912 set impl(ContactsService _) { |
| 913 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 914 } |
| 915 |
876 @override | 916 @override |
877 String toString() { | 917 String toString() { |
878 var superString = super.toString(); | 918 var superString = super.toString(); |
879 return "_ContactsServiceProxyControl($superString)"; | 919 return "_ContactsServiceProxyControl($superString)"; |
880 } | 920 } |
881 } | 921 } |
882 | 922 |
883 class ContactsServiceProxy | 923 class ContactsServiceProxy |
884 extends bindings.Proxy | 924 extends bindings.Proxy<ContactsService> |
885 implements ContactsService { | 925 implements ContactsService, |
| 926 ContactsServiceInterface, |
| 927 ContactsServiceInterfaceRequest { |
886 ContactsServiceProxy.fromEndpoint( | 928 ContactsServiceProxy.fromEndpoint( |
887 core.MojoMessagePipeEndpoint endpoint) | 929 core.MojoMessagePipeEndpoint endpoint) |
888 : super(new _ContactsServiceProxyControl.fromEndpoint(endpoint)); | 930 : super(new _ContactsServiceProxyControl.fromEndpoint(endpoint)); |
889 | 931 |
890 ContactsServiceProxy.fromHandle(core.MojoHandle handle) | 932 ContactsServiceProxy.fromHandle(core.MojoHandle handle) |
891 : super(new _ContactsServiceProxyControl.fromHandle(handle)); | 933 : super(new _ContactsServiceProxyControl.fromHandle(handle)); |
892 | 934 |
893 ContactsServiceProxy.unbound() | 935 ContactsServiceProxy.unbound() |
894 : super(new _ContactsServiceProxyControl.unbound()); | 936 : super(new _ContactsServiceProxyControl.unbound()); |
895 | 937 |
896 static ContactsServiceProxy newFromEndpoint( | 938 static ContactsServiceProxy newFromEndpoint( |
897 core.MojoMessagePipeEndpoint endpoint) { | 939 core.MojoMessagePipeEndpoint endpoint) { |
898 assert(endpoint.setDescription("For ContactsServiceProxy")); | 940 assert(endpoint.setDescription("For ContactsServiceProxy")); |
899 return new ContactsServiceProxy.fromEndpoint(endpoint); | 941 return new ContactsServiceProxy.fromEndpoint(endpoint); |
900 } | 942 } |
901 | 943 |
902 factory ContactsServiceProxy.connectToService( | |
903 bindings.ServiceConnector s, String url, [String serviceName]) { | |
904 ContactsServiceProxy p = new ContactsServiceProxy.unbound(); | |
905 s.connectToService(url, p, serviceName); | |
906 return p; | |
907 } | |
908 | |
909 | 944 |
910 dynamic getCount(String filter,[Function responseFactory = null]) { | 945 dynamic getCount(String filter,[Function responseFactory = null]) { |
911 var params = new _ContactsServiceGetCountParams(); | 946 var params = new _ContactsServiceGetCountParams(); |
912 params.filter = filter; | 947 params.filter = filter; |
913 return ctrl.sendMessageWithRequestId( | 948 return ctrl.sendMessageWithRequestId( |
914 params, | 949 params, |
915 _contactsServiceMethodGetCountName, | 950 _contactsServiceMethodGetCountName, |
916 -1, | 951 -1, |
917 bindings.MessageHeader.kMessageExpectsResponse); | 952 bindings.MessageHeader.kMessageExpectsResponse); |
918 } | 953 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 } | 995 } |
961 | 996 |
962 _ContactsServiceStubControl.fromHandle( | 997 _ContactsServiceStubControl.fromHandle( |
963 core.MojoHandle handle, [ContactsService impl]) | 998 core.MojoHandle handle, [ContactsService impl]) |
964 : super.fromHandle(handle, autoBegin: impl != null) { | 999 : super.fromHandle(handle, autoBegin: impl != null) { |
965 _impl = impl; | 1000 _impl = impl; |
966 } | 1001 } |
967 | 1002 |
968 _ContactsServiceStubControl.unbound([this._impl]) : super.unbound(); | 1003 _ContactsServiceStubControl.unbound([this._impl]) : super.unbound(); |
969 | 1004 |
| 1005 String get serviceName => ContactsService.serviceName; |
| 1006 |
970 | 1007 |
971 ContactsServiceGetCountResponseParams _contactsServiceGetCountResponseParamsFa
ctory(int count) { | 1008 ContactsServiceGetCountResponseParams _contactsServiceGetCountResponseParamsFa
ctory(int count) { |
972 var result = new ContactsServiceGetCountResponseParams(); | 1009 var result = new ContactsServiceGetCountResponseParams(); |
973 result.count = count; | 1010 result.count = count; |
974 return result; | 1011 return result; |
975 } | 1012 } |
976 ContactsServiceGetResponseParams _contactsServiceGetResponseParamsFactory(List
<Contact> contacts) { | 1013 ContactsServiceGetResponseParams _contactsServiceGetResponseParamsFactory(List
<Contact> contacts) { |
977 var result = new ContactsServiceGetResponseParams(); | 1014 var result = new ContactsServiceGetResponseParams(); |
978 result.contacts = contacts; | 1015 result.contacts = contacts; |
979 return result; | 1016 return result; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 } | 1150 } |
1114 } | 1151 } |
1115 | 1152 |
1116 @override | 1153 @override |
1117 String toString() { | 1154 String toString() { |
1118 var superString = super.toString(); | 1155 var superString = super.toString(); |
1119 return "_ContactsServiceStubControl($superString)"; | 1156 return "_ContactsServiceStubControl($superString)"; |
1120 } | 1157 } |
1121 | 1158 |
1122 int get version => 0; | 1159 int get version => 0; |
1123 | |
1124 static service_describer.ServiceDescription _cachedServiceDescription; | |
1125 static service_describer.ServiceDescription get serviceDescription { | |
1126 if (_cachedServiceDescription == null) { | |
1127 _cachedServiceDescription = new _ContactsServiceServiceDescription(); | |
1128 } | |
1129 return _cachedServiceDescription; | |
1130 } | |
1131 } | 1160 } |
1132 | 1161 |
1133 class ContactsServiceStub | 1162 class ContactsServiceStub |
1134 extends bindings.Stub<ContactsService> | 1163 extends bindings.Stub<ContactsService> |
1135 implements ContactsService { | 1164 implements ContactsService, |
| 1165 ContactsServiceInterface, |
| 1166 ContactsServiceInterfaceRequest { |
| 1167 ContactsServiceStub.unbound([ContactsService impl]) |
| 1168 : super(new _ContactsServiceStubControl.unbound(impl)); |
| 1169 |
1136 ContactsServiceStub.fromEndpoint( | 1170 ContactsServiceStub.fromEndpoint( |
1137 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) | 1171 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) |
1138 : super(new _ContactsServiceStubControl.fromEndpoint(endpoint, impl)); | 1172 : super(new _ContactsServiceStubControl.fromEndpoint(endpoint, impl)); |
1139 | 1173 |
1140 ContactsServiceStub.fromHandle( | 1174 ContactsServiceStub.fromHandle( |
1141 core.MojoHandle handle, [ContactsService impl]) | 1175 core.MojoHandle handle, [ContactsService impl]) |
1142 : super(new _ContactsServiceStubControl.fromHandle(handle, impl)); | 1176 : super(new _ContactsServiceStubControl.fromHandle(handle, impl)); |
1143 | 1177 |
1144 ContactsServiceStub.unbound([ContactsService impl]) | |
1145 : super(new _ContactsServiceStubControl.unbound(impl)); | |
1146 | |
1147 static ContactsServiceStub newFromEndpoint( | 1178 static ContactsServiceStub newFromEndpoint( |
1148 core.MojoMessagePipeEndpoint endpoint) { | 1179 core.MojoMessagePipeEndpoint endpoint) { |
1149 assert(endpoint.setDescription("For ContactsServiceStub")); | 1180 assert(endpoint.setDescription("For ContactsServiceStub")); |
1150 return new ContactsServiceStub.fromEndpoint(endpoint); | 1181 return new ContactsServiceStub.fromEndpoint(endpoint); |
1151 } | 1182 } |
1152 | 1183 |
1153 static service_describer.ServiceDescription get serviceDescription => | |
1154 _ContactsServiceStubControl.serviceDescription; | |
1155 | |
1156 | 1184 |
1157 dynamic getCount(String filter,[Function responseFactory = null]) { | 1185 dynamic getCount(String filter,[Function responseFactory = null]) { |
1158 return impl.getCount(filter,responseFactory); | 1186 return impl.getCount(filter,responseFactory); |
1159 } | 1187 } |
1160 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]) { | 1188 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]) { |
1161 return impl.get(filter,offset,limit,responseFactory); | 1189 return impl.get(filter,offset,limit,responseFactory); |
1162 } | 1190 } |
1163 dynamic getEmails(int id,[Function responseFactory = null]) { | 1191 dynamic getEmails(int id,[Function responseFactory = null]) { |
1164 return impl.getEmails(id,responseFactory); | 1192 return impl.getEmails(id,responseFactory); |
1165 } | 1193 } |
1166 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
{ | 1194 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
{ |
1167 return impl.getPhoto(id,highResolution,responseFactory); | 1195 return impl.getPhoto(id,highResolution,responseFactory); |
1168 } | 1196 } |
1169 } | 1197 } |
1170 | 1198 |
1171 | 1199 |
1172 | 1200 |
OLD | NEW |