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 geocoder_mojom; | 5 library geocoder_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/location.mojom.dart' as location_mojom; | 10 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom; |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 dynamic getAllTypeDefinitions([Function responseFactory]) => | 1097 dynamic getAllTypeDefinitions([Function responseFactory]) => |
1098 responseFactory(null); | 1098 responseFactory(null); |
1099 } | 1099 } |
1100 | 1100 |
1101 abstract class Geocoder { | 1101 abstract class Geocoder { |
1102 static const String serviceName = null; | 1102 static const String serviceName = null; |
1103 dynamic addressToLocation(String address,Options options,[Function responseFac
tory = null]); | 1103 dynamic addressToLocation(String address,Options options,[Function responseFac
tory = null]); |
1104 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu
nction responseFactory = null]); | 1104 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu
nction responseFactory = null]); |
1105 } | 1105 } |
1106 | 1106 |
1107 | 1107 class _GeocoderProxyControl |
1108 class _GeocoderProxyControl extends bindings.ProxyMessageHandler | 1108 extends bindings.ProxyMessageHandler |
1109 implements bindings.ProxyControl { | 1109 implements bindings.ProxyControl { |
1110 _GeocoderProxyControl.fromEndpoint( | 1110 _GeocoderProxyControl.fromEndpoint( |
1111 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 1111 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
1112 | 1112 |
1113 _GeocoderProxyControl.fromHandle( | 1113 _GeocoderProxyControl.fromHandle( |
1114 core.MojoHandle handle) : super.fromHandle(handle); | 1114 core.MojoHandle handle) : super.fromHandle(handle); |
1115 | 1115 |
1116 _GeocoderProxyControl.unbound() : super.unbound(); | 1116 _GeocoderProxyControl.unbound() : super.unbound(); |
1117 | 1117 |
1118 service_describer.ServiceDescription get serviceDescription => | 1118 service_describer.ServiceDescription get serviceDescription => |
1119 new _GeocoderServiceDescription(); | 1119 new _GeocoderServiceDescription(); |
1120 | 1120 |
1121 String get serviceName => Geocoder.serviceName; | 1121 String get serviceName => Geocoder.serviceName; |
1122 | 1122 |
1123 @override | |
1124 void handleResponse(bindings.ServiceMessage message) { | 1123 void handleResponse(bindings.ServiceMessage message) { |
1125 switch (message.header.type) { | 1124 switch (message.header.type) { |
1126 case _geocoderMethodAddressToLocationName: | 1125 case _geocoderMethodAddressToLocationName: |
1127 var r = GeocoderAddressToLocationResponseParams.deserialize( | 1126 var r = GeocoderAddressToLocationResponseParams.deserialize( |
1128 message.payload); | 1127 message.payload); |
1129 if (!message.header.hasRequestId) { | 1128 if (!message.header.hasRequestId) { |
1130 proxyError("Expected a message with a valid request Id."); | 1129 proxyError("Expected a message with a valid request Id."); |
1131 return; | 1130 return; |
1132 } | 1131 } |
1133 Completer c = completerMap[message.header.requestId]; | 1132 Completer c = completerMap[message.header.requestId]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 } | 1169 } |
1171 } | 1170 } |
1172 | 1171 |
1173 @override | 1172 @override |
1174 String toString() { | 1173 String toString() { |
1175 var superString = super.toString(); | 1174 var superString = super.toString(); |
1176 return "_GeocoderProxyControl($superString)"; | 1175 return "_GeocoderProxyControl($superString)"; |
1177 } | 1176 } |
1178 } | 1177 } |
1179 | 1178 |
1180 | 1179 class GeocoderProxy |
1181 class GeocoderProxy extends bindings.Proxy | 1180 extends bindings.Proxy |
1182 implements Geocoder { | 1181 implements Geocoder { |
1183 GeocoderProxy.fromEndpoint( | 1182 GeocoderProxy.fromEndpoint( |
1184 core.MojoMessagePipeEndpoint endpoint) | 1183 core.MojoMessagePipeEndpoint endpoint) |
1185 : super(new _GeocoderProxyControl.fromEndpoint(endpoint)); | 1184 : super(new _GeocoderProxyControl.fromEndpoint(endpoint)); |
1186 | 1185 |
1187 GeocoderProxy.fromHandle(core.MojoHandle handle) | 1186 GeocoderProxy.fromHandle(core.MojoHandle handle) |
1188 : super(new _GeocoderProxyControl.fromHandle(handle)); | 1187 : super(new _GeocoderProxyControl.fromHandle(handle)); |
1189 | 1188 |
1190 GeocoderProxy.unbound() | 1189 GeocoderProxy.unbound() |
1191 : super(new _GeocoderProxyControl.unbound()); | 1190 : super(new _GeocoderProxyControl.unbound()); |
1192 | 1191 |
(...skipping 26 matching lines...) Expand all Loading... |
1219 params.location = location; | 1218 params.location = location; |
1220 params.options = options; | 1219 params.options = options; |
1221 return ctrl.sendMessageWithRequestId( | 1220 return ctrl.sendMessageWithRequestId( |
1222 params, | 1221 params, |
1223 _geocoderMethodLocationToAddressName, | 1222 _geocoderMethodLocationToAddressName, |
1224 -1, | 1223 -1, |
1225 bindings.MessageHeader.kMessageExpectsResponse); | 1224 bindings.MessageHeader.kMessageExpectsResponse); |
1226 } | 1225 } |
1227 } | 1226 } |
1228 | 1227 |
1229 | 1228 class _GeocoderStubControl |
1230 class GeocoderStub extends bindings.Stub { | 1229 extends bindings.StubMessageHandler |
| 1230 implements bindings.StubControl<Geocoder> { |
1231 Geocoder _impl; | 1231 Geocoder _impl; |
1232 | 1232 |
1233 GeocoderStub.fromEndpoint( | 1233 _GeocoderStubControl.fromEndpoint( |
1234 core.MojoMessagePipeEndpoint endpoint, [Geocoder impl]) | 1234 core.MojoMessagePipeEndpoint endpoint, [Geocoder impl]) |
1235 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 1235 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
1236 _impl = impl; | 1236 _impl = impl; |
1237 } | 1237 } |
1238 | 1238 |
1239 GeocoderStub.fromHandle( | 1239 _GeocoderStubControl.fromHandle( |
1240 core.MojoHandle handle, [Geocoder impl]) | 1240 core.MojoHandle handle, [Geocoder impl]) |
1241 : super.fromHandle(handle, autoBegin: impl != null) { | 1241 : super.fromHandle(handle, autoBegin: impl != null) { |
1242 _impl = impl; | 1242 _impl = impl; |
1243 } | 1243 } |
1244 | 1244 |
1245 GeocoderStub.unbound([this._impl]) : super.unbound(); | 1245 _GeocoderStubControl.unbound([this._impl]) : super.unbound(); |
1246 | |
1247 static GeocoderStub newFromEndpoint( | |
1248 core.MojoMessagePipeEndpoint endpoint) { | |
1249 assert(endpoint.setDescription("For GeocoderStub")); | |
1250 return new GeocoderStub.fromEndpoint(endpoint); | |
1251 } | |
1252 | 1246 |
1253 | 1247 |
1254 GeocoderAddressToLocationResponseParams _geocoderAddressToLocationResponsePara
msFactory(String status, List<Result> results) { | 1248 GeocoderAddressToLocationResponseParams _geocoderAddressToLocationResponsePara
msFactory(String status, List<Result> results) { |
1255 var result = new GeocoderAddressToLocationResponseParams(); | 1249 var result = new GeocoderAddressToLocationResponseParams(); |
1256 result.status = status; | 1250 result.status = status; |
1257 result.results = results; | 1251 result.results = results; |
1258 return result; | 1252 return result; |
1259 } | 1253 } |
1260 GeocoderLocationToAddressResponseParams _geocoderLocationToAddressResponsePara
msFactory(String status, List<Result> results) { | 1254 GeocoderLocationToAddressResponseParams _geocoderLocationToAddressResponsePara
msFactory(String status, List<Result> results) { |
1261 var result = new GeocoderLocationToAddressResponseParams(); | 1255 var result = new GeocoderLocationToAddressResponseParams(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 } | 1331 } |
1338 | 1332 |
1339 @override | 1333 @override |
1340 void bind(core.MojoMessagePipeEndpoint endpoint) { | 1334 void bind(core.MojoMessagePipeEndpoint endpoint) { |
1341 super.bind(endpoint); | 1335 super.bind(endpoint); |
1342 if (!isOpen && (_impl != null)) { | 1336 if (!isOpen && (_impl != null)) { |
1343 beginHandlingEvents(); | 1337 beginHandlingEvents(); |
1344 } | 1338 } |
1345 } | 1339 } |
1346 | 1340 |
| 1341 @override |
1347 String toString() { | 1342 String toString() { |
1348 var superString = super.toString(); | 1343 var superString = super.toString(); |
1349 return "GeocoderStub($superString)"; | 1344 return "_GeocoderStubControl($superString)"; |
1350 } | 1345 } |
1351 | 1346 |
1352 int get version => 0; | 1347 int get version => 0; |
1353 | 1348 |
1354 static service_describer.ServiceDescription _cachedServiceDescription; | 1349 static service_describer.ServiceDescription _cachedServiceDescription; |
1355 static service_describer.ServiceDescription get serviceDescription { | 1350 static service_describer.ServiceDescription get serviceDescription { |
1356 if (_cachedServiceDescription == null) { | 1351 if (_cachedServiceDescription == null) { |
1357 _cachedServiceDescription = new _GeocoderServiceDescription(); | 1352 _cachedServiceDescription = new _GeocoderServiceDescription(); |
1358 } | 1353 } |
1359 return _cachedServiceDescription; | 1354 return _cachedServiceDescription; |
1360 } | 1355 } |
1361 } | 1356 } |
1362 | 1357 |
| 1358 class GeocoderStub |
| 1359 extends bindings.Stub<Geocoder> |
| 1360 implements Geocoder { |
| 1361 GeocoderStub.fromEndpoint( |
| 1362 core.MojoMessagePipeEndpoint endpoint, [Geocoder impl]) |
| 1363 : super(new _GeocoderStubControl.fromEndpoint(endpoint, impl)); |
| 1364 |
| 1365 GeocoderStub.fromHandle( |
| 1366 core.MojoHandle handle, [Geocoder impl]) |
| 1367 : super(new _GeocoderStubControl.fromHandle(handle, impl)); |
| 1368 |
| 1369 GeocoderStub.unbound([Geocoder impl]) |
| 1370 : super(new _GeocoderStubControl.unbound(impl)); |
| 1371 |
| 1372 static GeocoderStub newFromEndpoint( |
| 1373 core.MojoMessagePipeEndpoint endpoint) { |
| 1374 assert(endpoint.setDescription("For GeocoderStub")); |
| 1375 return new GeocoderStub.fromEndpoint(endpoint); |
| 1376 } |
| 1377 |
| 1378 static service_describer.ServiceDescription get serviceDescription => |
| 1379 _GeocoderStubControl.serviceDescription; |
| 1380 |
| 1381 |
| 1382 dynamic addressToLocation(String address,Options options,[Function responseFac
tory = null]) { |
| 1383 return impl.addressToLocation(address,options,responseFactory); |
| 1384 } |
| 1385 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu
nction responseFactory = null]) { |
| 1386 return impl.locationToAddress(location,options,responseFactory); |
| 1387 } |
| 1388 } |
| 1389 |
1363 | 1390 |
1364 | 1391 |
OLD | NEW |