| 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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 impl.requireVersion(requiredVersion); | 982 impl.requireVersion(requiredVersion); |
| 983 } | 983 } |
| 984 | 984 |
| 985 String toString() { | 985 String toString() { |
| 986 return "ContactsServiceProxy($impl)"; | 986 return "ContactsServiceProxy($impl)"; |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 | 990 |
| 991 class ContactsServiceStub extends bindings.Stub { | 991 class ContactsServiceStub extends bindings.Stub { |
| 992 ContactsService _impl = null; | 992 ContactsService _impl; |
| 993 | 993 |
| 994 ContactsServiceStub.fromEndpoint( | 994 ContactsServiceStub.fromEndpoint( |
| 995 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 995 core.MojoMessagePipeEndpoint endpoint, [ContactsService impl]) |
| 996 : super.fromEndpoint(endpoint); | 996 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 997 _impl = impl; |
| 998 } |
| 997 | 999 |
| 998 ContactsServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1000 ContactsServiceStub.fromHandle( |
| 999 : super.fromHandle(handle); | 1001 core.MojoHandle handle, [ContactsService impl]) |
| 1002 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1003 _impl = impl; |
| 1004 } |
| 1000 | 1005 |
| 1001 ContactsServiceStub.unbound() : super.unbound(); | 1006 ContactsServiceStub.unbound() : super.unbound(); |
| 1002 | 1007 |
| 1003 static ContactsServiceStub newFromEndpoint( | 1008 static ContactsServiceStub newFromEndpoint( |
| 1004 core.MojoMessagePipeEndpoint endpoint) { | 1009 core.MojoMessagePipeEndpoint endpoint) { |
| 1005 assert(endpoint.setDescription("For ContactsServiceStub")); | 1010 assert(endpoint.setDescription("For ContactsServiceStub")); |
| 1006 return new ContactsServiceStub.fromEndpoint(endpoint); | 1011 return new ContactsServiceStub.fromEndpoint(endpoint); |
| 1007 } | 1012 } |
| 1008 | 1013 |
| 1009 | 1014 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1027 result.photoUrl = photoUrl; | 1032 result.photoUrl = photoUrl; |
| 1028 return result; | 1033 return result; |
| 1029 } | 1034 } |
| 1030 | 1035 |
| 1031 dynamic handleMessage(bindings.ServiceMessage message) { | 1036 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1032 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1037 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1033 return bindings.ControlMessageHandler.handleMessage(this, | 1038 return bindings.ControlMessageHandler.handleMessage(this, |
| 1034 0, | 1039 0, |
| 1035 message); | 1040 message); |
| 1036 } | 1041 } |
| 1037 assert(_impl != null); | 1042 if (_impl == null) { |
| 1043 throw new core.MojoApiError("$this has no implementation set"); |
| 1044 } |
| 1038 switch (message.header.type) { | 1045 switch (message.header.type) { |
| 1039 case _contactsServiceMethodGetCountName: | 1046 case _contactsServiceMethodGetCountName: |
| 1040 var params = _ContactsServiceGetCountParams.deserialize( | 1047 var params = _ContactsServiceGetCountParams.deserialize( |
| 1041 message.payload); | 1048 message.payload); |
| 1042 var response = _impl.getCount(params.filter,_contactsServiceGetCountResp
onseParamsFactory); | 1049 var response = _impl.getCount(params.filter,_contactsServiceGetCountResp
onseParamsFactory); |
| 1043 if (response is Future) { | 1050 if (response is Future) { |
| 1044 return response.then((response) { | 1051 return response.then((response) { |
| 1045 if (response != null) { | 1052 if (response != null) { |
| 1046 return buildResponseWithId( | 1053 return buildResponseWithId( |
| 1047 response, | 1054 response, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 break; | 1133 break; |
| 1127 default: | 1134 default: |
| 1128 throw new bindings.MojoCodecError("Unexpected message name"); | 1135 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1129 break; | 1136 break; |
| 1130 } | 1137 } |
| 1131 return null; | 1138 return null; |
| 1132 } | 1139 } |
| 1133 | 1140 |
| 1134 ContactsService get impl => _impl; | 1141 ContactsService get impl => _impl; |
| 1135 set impl(ContactsService d) { | 1142 set impl(ContactsService d) { |
| 1136 assert(_impl == null); | 1143 if (d == null) { |
| 1144 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1145 } |
| 1146 if (isBound && (_impl == null)) { |
| 1147 beginHandlingEvents(); |
| 1148 } |
| 1137 _impl = d; | 1149 _impl = d; |
| 1138 } | 1150 } |
| 1139 | 1151 |
| 1152 @override |
| 1153 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1154 super.bind(endpoint); |
| 1155 if (!isOpen && (_impl != null)) { |
| 1156 beginHandlingEvents(); |
| 1157 } |
| 1158 } |
| 1159 |
| 1140 String toString() { | 1160 String toString() { |
| 1141 var superString = super.toString(); | 1161 var superString = super.toString(); |
| 1142 return "ContactsServiceStub($superString)"; | 1162 return "ContactsServiceStub($superString)"; |
| 1143 } | 1163 } |
| 1144 | 1164 |
| 1145 int get version => 0; | 1165 int get version => 0; |
| 1146 | 1166 |
| 1147 static service_describer.ServiceDescription _cachedServiceDescription; | 1167 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1148 static service_describer.ServiceDescription get serviceDescription { | 1168 static service_describer.ServiceDescription get serviceDescription { |
| 1149 if (_cachedServiceDescription == null) { | 1169 if (_cachedServiceDescription == null) { |
| 1150 _cachedServiceDescription = new _ContactsServiceServiceDescription(); | 1170 _cachedServiceDescription = new _ContactsServiceServiceDescription(); |
| 1151 } | 1171 } |
| 1152 return _cachedServiceDescription; | 1172 return _cachedServiceDescription; |
| 1153 } | 1173 } |
| 1154 } | 1174 } |
| 1155 | 1175 |
| 1156 | 1176 |
| 1157 | 1177 |
| OLD | NEW |