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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 dynamic getCount(String filter,[Function responseFactory = null]); | 765 dynamic getCount(String filter,[Function responseFactory = null]); |
766 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]); | 766 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]); |
767 dynamic getEmails(int id,[Function responseFactory = null]); | 767 dynamic getEmails(int id,[Function responseFactory = null]); |
768 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
; | 768 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
; |
769 } | 769 } |
770 | 770 |
771 | 771 |
772 class _ContactsServiceProxyImpl extends bindings.Proxy { | 772 class _ContactsServiceProxyControl extends bindings.ProxyMessageHandler |
773 _ContactsServiceProxyImpl.fromEndpoint( | 773 implements bindings.ProxyControl { |
| 774 _ContactsServiceProxyControl.fromEndpoint( |
774 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 775 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
775 | 776 |
776 _ContactsServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 777 _ContactsServiceProxyControl.fromHandle( |
777 super.fromHandle(handle); | 778 core.MojoHandle handle) : super.fromHandle(handle); |
778 | 779 |
779 _ContactsServiceProxyImpl.unbound() : super.unbound(); | 780 _ContactsServiceProxyControl.unbound() : super.unbound(); |
780 | |
781 static _ContactsServiceProxyImpl newFromEndpoint( | |
782 core.MojoMessagePipeEndpoint endpoint) { | |
783 assert(endpoint.setDescription("For _ContactsServiceProxyImpl")); | |
784 return new _ContactsServiceProxyImpl.fromEndpoint(endpoint); | |
785 } | |
786 | 781 |
787 service_describer.ServiceDescription get serviceDescription => | 782 service_describer.ServiceDescription get serviceDescription => |
788 new _ContactsServiceServiceDescription(); | 783 new _ContactsServiceServiceDescription(); |
789 | 784 |
| 785 String get serviceName => ContactsService.serviceName; |
| 786 |
| 787 @override |
790 void handleResponse(bindings.ServiceMessage message) { | 788 void handleResponse(bindings.ServiceMessage message) { |
791 switch (message.header.type) { | 789 switch (message.header.type) { |
792 case _contactsServiceMethodGetCountName: | 790 case _contactsServiceMethodGetCountName: |
793 var r = ContactsServiceGetCountResponseParams.deserialize( | 791 var r = ContactsServiceGetCountResponseParams.deserialize( |
794 message.payload); | 792 message.payload); |
795 if (!message.header.hasRequestId) { | 793 if (!message.header.hasRequestId) { |
796 proxyError("Expected a message with a valid request Id."); | 794 proxyError("Expected a message with a valid request Id."); |
797 return; | 795 return; |
798 } | 796 } |
799 Completer c = completerMap[message.header.requestId]; | 797 Completer c = completerMap[message.header.requestId]; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 } | 867 } |
870 c.complete(r); | 868 c.complete(r); |
871 break; | 869 break; |
872 default: | 870 default: |
873 proxyError("Unexpected message type: ${message.header.type}"); | 871 proxyError("Unexpected message type: ${message.header.type}"); |
874 close(immediate: true); | 872 close(immediate: true); |
875 break; | 873 break; |
876 } | 874 } |
877 } | 875 } |
878 | 876 |
| 877 @override |
879 String toString() { | 878 String toString() { |
880 var superString = super.toString(); | 879 var superString = super.toString(); |
881 return "_ContactsServiceProxyImpl($superString)"; | 880 return "_ContactsServiceProxyControl($superString)"; |
882 } | 881 } |
883 } | 882 } |
884 | 883 |
885 | 884 |
886 class _ContactsServiceProxyCalls implements ContactsService { | 885 class ContactsServiceProxy extends bindings.Proxy |
887 _ContactsServiceProxyImpl _proxyImpl; | 886 implements ContactsService { |
| 887 ContactsServiceProxy.fromEndpoint( |
| 888 core.MojoMessagePipeEndpoint endpoint) |
| 889 : super(new _ContactsServiceProxyControl.fromEndpoint(endpoint)); |
888 | 890 |
889 _ContactsServiceProxyCalls(this._proxyImpl); | 891 ContactsServiceProxy.fromHandle(core.MojoHandle handle) |
890 dynamic getCount(String filter,[Function responseFactory = null]) { | 892 : super(new _ContactsServiceProxyControl.fromHandle(handle)); |
891 var params = new _ContactsServiceGetCountParams(); | |
892 params.filter = filter; | |
893 return _proxyImpl.sendMessageWithRequestId( | |
894 params, | |
895 _contactsServiceMethodGetCountName, | |
896 -1, | |
897 bindings.MessageHeader.kMessageExpectsResponse); | |
898 } | |
899 dynamic get(String filter,int offset,int limit,[Function responseFactory = n
ull]) { | |
900 var params = new _ContactsServiceGetParams(); | |
901 params.filter = filter; | |
902 params.offset = offset; | |
903 params.limit = limit; | |
904 return _proxyImpl.sendMessageWithRequestId( | |
905 params, | |
906 _contactsServiceMethodGetName, | |
907 -1, | |
908 bindings.MessageHeader.kMessageExpectsResponse); | |
909 } | |
910 dynamic getEmails(int id,[Function responseFactory = null]) { | |
911 var params = new _ContactsServiceGetEmailsParams(); | |
912 params.id = id; | |
913 return _proxyImpl.sendMessageWithRequestId( | |
914 params, | |
915 _contactsServiceMethodGetEmailsName, | |
916 -1, | |
917 bindings.MessageHeader.kMessageExpectsResponse); | |
918 } | |
919 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null
]) { | |
920 var params = new _ContactsServiceGetPhotoParams(); | |
921 params.id = id; | |
922 params.highResolution = highResolution; | |
923 return _proxyImpl.sendMessageWithRequestId( | |
924 params, | |
925 _contactsServiceMethodGetPhotoName, | |
926 -1, | |
927 bindings.MessageHeader.kMessageExpectsResponse); | |
928 } | |
929 } | |
930 | 893 |
| 894 ContactsServiceProxy.unbound() |
| 895 : super(new _ContactsServiceProxyControl.unbound()); |
931 | 896 |
932 class ContactsServiceProxy implements bindings.ProxyBase { | 897 static ContactsServiceProxy newFromEndpoint( |
933 final bindings.Proxy impl; | 898 core.MojoMessagePipeEndpoint endpoint) { |
934 ContactsService ptr; | 899 assert(endpoint.setDescription("For ContactsServiceProxy")); |
935 | 900 return new ContactsServiceProxy.fromEndpoint(endpoint); |
936 ContactsServiceProxy(_ContactsServiceProxyImpl proxyImpl) : | |
937 impl = proxyImpl, | |
938 ptr = new _ContactsServiceProxyCalls(proxyImpl); | |
939 | |
940 ContactsServiceProxy.fromEndpoint( | |
941 core.MojoMessagePipeEndpoint endpoint) : | |
942 impl = new _ContactsServiceProxyImpl.fromEndpoint(endpoint) { | |
943 ptr = new _ContactsServiceProxyCalls(impl); | |
944 } | |
945 | |
946 ContactsServiceProxy.fromHandle(core.MojoHandle handle) : | |
947 impl = new _ContactsServiceProxyImpl.fromHandle(handle) { | |
948 ptr = new _ContactsServiceProxyCalls(impl); | |
949 } | |
950 | |
951 ContactsServiceProxy.unbound() : | |
952 impl = new _ContactsServiceProxyImpl.unbound() { | |
953 ptr = new _ContactsServiceProxyCalls(impl); | |
954 } | 901 } |
955 | 902 |
956 factory ContactsServiceProxy.connectToService( | 903 factory ContactsServiceProxy.connectToService( |
957 bindings.ServiceConnector s, String url, [String serviceName]) { | 904 bindings.ServiceConnector s, String url, [String serviceName]) { |
958 ContactsServiceProxy p = new ContactsServiceProxy.unbound(); | 905 ContactsServiceProxy p = new ContactsServiceProxy.unbound(); |
959 s.connectToService(url, p, serviceName); | 906 s.connectToService(url, p, serviceName); |
960 return p; | 907 return p; |
961 } | 908 } |
962 | 909 |
963 static ContactsServiceProxy newFromEndpoint( | 910 |
964 core.MojoMessagePipeEndpoint endpoint) { | 911 dynamic getCount(String filter,[Function responseFactory = null]) { |
965 assert(endpoint.setDescription("For ContactsServiceProxy")); | 912 var params = new _ContactsServiceGetCountParams(); |
966 return new ContactsServiceProxy.fromEndpoint(endpoint); | 913 params.filter = filter; |
| 914 return ctrl.sendMessageWithRequestId( |
| 915 params, |
| 916 _contactsServiceMethodGetCountName, |
| 917 -1, |
| 918 bindings.MessageHeader.kMessageExpectsResponse); |
967 } | 919 } |
968 | 920 dynamic get(String filter,int offset,int limit,[Function responseFactory = nul
l]) { |
969 String get serviceName => ContactsService.serviceName; | 921 var params = new _ContactsServiceGetParams(); |
970 | 922 params.filter = filter; |
971 Future close({bool immediate: false}) => impl.close(immediate: immediate); | 923 params.offset = offset; |
972 | 924 params.limit = limit; |
973 Future responseOrError(Future f) => impl.responseOrError(f); | 925 return ctrl.sendMessageWithRequestId( |
974 | 926 params, |
975 Future get errorFuture => impl.errorFuture; | 927 _contactsServiceMethodGetName, |
976 | 928 -1, |
977 int get version => impl.version; | 929 bindings.MessageHeader.kMessageExpectsResponse); |
978 | |
979 Future<int> queryVersion() => impl.queryVersion(); | |
980 | |
981 void requireVersion(int requiredVersion) { | |
982 impl.requireVersion(requiredVersion); | |
983 } | 930 } |
984 | 931 dynamic getEmails(int id,[Function responseFactory = null]) { |
985 String toString() { | 932 var params = new _ContactsServiceGetEmailsParams(); |
986 return "ContactsServiceProxy($impl)"; | 933 params.id = id; |
| 934 return ctrl.sendMessageWithRequestId( |
| 935 params, |
| 936 _contactsServiceMethodGetEmailsName, |
| 937 -1, |
| 938 bindings.MessageHeader.kMessageExpectsResponse); |
| 939 } |
| 940 dynamic getPhoto(int id,bool highResolution,[Function responseFactory = null])
{ |
| 941 var params = new _ContactsServiceGetPhotoParams(); |
| 942 params.id = id; |
| 943 params.highResolution = highResolution; |
| 944 return ctrl.sendMessageWithRequestId( |
| 945 params, |
| 946 _contactsServiceMethodGetPhotoName, |
| 947 -1, |
| 948 bindings.MessageHeader.kMessageExpectsResponse); |
987 } | 949 } |
988 } | 950 } |
989 | 951 |
990 | 952 |
991 class ContactsServiceStub extends bindings.Stub { | 953 class ContactsServiceStub extends bindings.Stub { |
992 ContactsService _impl; | 954 ContactsService _impl; |
993 | 955 |
994 ContactsServiceStub.fromEndpoint( | 956 ContactsServiceStub.fromEndpoint( |
995 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) | 957 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) |
996 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 958 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 static service_describer.ServiceDescription get serviceDescription { | 1130 static service_describer.ServiceDescription get serviceDescription { |
1169 if (_cachedServiceDescription == null) { | 1131 if (_cachedServiceDescription == null) { |
1170 _cachedServiceDescription = new _ContactsServiceServiceDescription(); | 1132 _cachedServiceDescription = new _ContactsServiceServiceDescription(); |
1171 } | 1133 } |
1172 return _cachedServiceDescription; | 1134 return _cachedServiceDescription; |
1173 } | 1135 } |
1174 } | 1136 } |
1175 | 1137 |
1176 | 1138 |
1177 | 1139 |
OLD | NEW |