| OLD | NEW |
| 1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
| 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
| 3 | 3 |
| 4 library location_service_mojom; | 4 library location_service_mojom; |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
| 7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
| 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 9 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom; | 9 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom; |
| 10 | 10 |
| 11 | 11 |
| 12 | 12 |
| 13 class _LocationServiceGetNextLocationParams extends bindings.Struct { | 13 class _LocationServiceGetNextLocationParams extends bindings.Struct { |
| 14 static const List<bindings.StructDataHeader> kVersions = const [ | 14 static const List<bindings.StructDataHeader> kVersions = const [ |
| 15 const bindings.StructDataHeader(16, 0) | 15 const bindings.StructDataHeader(16, 0) |
| 16 ]; | 16 ]; |
| 17 LocationServiceUpdatePriority priority = null; | 17 LocationServiceUpdatePriority priority = null; |
| 18 | 18 |
| 19 _LocationServiceGetNextLocationParams() : super(kVersions.last.size); | 19 _LocationServiceGetNextLocationParams() : super(kVersions.last.size); |
| 20 | 20 |
| 21 _LocationServiceGetNextLocationParams.init( |
| 22 LocationServiceUpdatePriority this.priority |
| 23 ) : super(kVersions.last.size); |
| 24 |
| 21 static _LocationServiceGetNextLocationParams deserialize(bindings.Message mess
age) { | 25 static _LocationServiceGetNextLocationParams deserialize(bindings.Message mess
age) { |
| 22 var decoder = new bindings.Decoder(message); | 26 var decoder = new bindings.Decoder(message); |
| 23 var result = decode(decoder); | 27 var result = decode(decoder); |
| 24 if (decoder.excessHandles != null) { | 28 if (decoder.excessHandles != null) { |
| 25 decoder.excessHandles.forEach((h) => h.close()); | 29 decoder.excessHandles.forEach((h) => h.close()); |
| 26 } | 30 } |
| 27 return result; | 31 return result; |
| 28 } | 32 } |
| 29 | 33 |
| 30 static _LocationServiceGetNextLocationParams decode(bindings.Decoder decoder0)
{ | 34 static _LocationServiceGetNextLocationParams decode(bindings.Decoder decoder0)
{ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 91 |
| 88 | 92 |
| 89 class LocationServiceGetNextLocationResponseParams extends bindings.Struct { | 93 class LocationServiceGetNextLocationResponseParams extends bindings.Struct { |
| 90 static const List<bindings.StructDataHeader> kVersions = const [ | 94 static const List<bindings.StructDataHeader> kVersions = const [ |
| 91 const bindings.StructDataHeader(16, 0) | 95 const bindings.StructDataHeader(16, 0) |
| 92 ]; | 96 ]; |
| 93 location_mojom.Location location = null; | 97 location_mojom.Location location = null; |
| 94 | 98 |
| 95 LocationServiceGetNextLocationResponseParams() : super(kVersions.last.size); | 99 LocationServiceGetNextLocationResponseParams() : super(kVersions.last.size); |
| 96 | 100 |
| 101 LocationServiceGetNextLocationResponseParams.init( |
| 102 location_mojom.Location this.location |
| 103 ) : super(kVersions.last.size); |
| 104 |
| 97 static LocationServiceGetNextLocationResponseParams deserialize(bindings.Messa
ge message) { | 105 static LocationServiceGetNextLocationResponseParams deserialize(bindings.Messa
ge message) { |
| 98 var decoder = new bindings.Decoder(message); | 106 var decoder = new bindings.Decoder(message); |
| 99 var result = decode(decoder); | 107 var result = decode(decoder); |
| 100 if (decoder.excessHandles != null) { | 108 if (decoder.excessHandles != null) { |
| 101 decoder.excessHandles.forEach((h) => h.close()); | 109 decoder.excessHandles.forEach((h) => h.close()); |
| 102 } | 110 } |
| 103 return result; | 111 return result; |
| 104 } | 112 } |
| 105 | 113 |
| 106 static LocationServiceGetNextLocationResponseParams decode(bindings.Decoder de
coder0) { | 114 static LocationServiceGetNextLocationResponseParams decode(bindings.Decoder de
coder0) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return 'LocationServiceUpdatePriority.priorityNoPower'; | 228 return 'LocationServiceUpdatePriority.priorityNoPower'; |
| 221 default: | 229 default: |
| 222 return null; | 230 return null; |
| 223 } | 231 } |
| 224 } | 232 } |
| 225 | 233 |
| 226 int toJson() => mojoEnumValue; | 234 int toJson() => mojoEnumValue; |
| 227 } | 235 } |
| 228 | 236 |
| 229 class _LocationServiceServiceDescription implements service_describer.ServiceDes
cription { | 237 class _LocationServiceServiceDescription implements service_describer.ServiceDes
cription { |
| 230 dynamic getTopLevelInterface([Function responseFactory]) => | 238 void getTopLevelInterface(Function responder) { |
| 231 responseFactory(null); | 239 responder(null); |
| 240 } |
| 232 | 241 |
| 233 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 242 void getTypeDefinition(String typeKey, Function responder) { |
| 234 responseFactory(null); | 243 responder(null); |
| 244 } |
| 235 | 245 |
| 236 dynamic getAllTypeDefinitions([Function responseFactory]) => | 246 void getAllTypeDefinitions(Function responder) { |
| 237 responseFactory(null); | 247 responder(null); |
| 248 } |
| 238 } | 249 } |
| 239 | 250 |
| 240 abstract class LocationService { | 251 abstract class LocationService { |
| 241 static const String serviceName = "mojo::LocationService"; | 252 static const String serviceName = "mojo::LocationService"; |
| 242 | 253 |
| 243 static service_describer.ServiceDescription _cachedServiceDescription; | 254 static service_describer.ServiceDescription _cachedServiceDescription; |
| 244 static service_describer.ServiceDescription get serviceDescription { | 255 static service_describer.ServiceDescription get serviceDescription { |
| 245 if (_cachedServiceDescription == null) { | 256 if (_cachedServiceDescription == null) { |
| 246 _cachedServiceDescription = new _LocationServiceServiceDescription(); | 257 _cachedServiceDescription = new _LocationServiceServiceDescription(); |
| 247 } | 258 } |
| 248 return _cachedServiceDescription; | 259 return _cachedServiceDescription; |
| 249 } | 260 } |
| 250 | 261 |
| 251 static LocationServiceProxy connectToService( | 262 static LocationServiceProxy connectToService( |
| 252 bindings.ServiceConnector s, String url, [String serviceName]) { | 263 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 253 LocationServiceProxy p = new LocationServiceProxy.unbound(); | 264 LocationServiceProxy p = new LocationServiceProxy.unbound(); |
| 254 String name = serviceName ?? LocationService.serviceName; | 265 String name = serviceName ?? LocationService.serviceName; |
| 255 if ((name == null) || name.isEmpty) { | 266 if ((name == null) || name.isEmpty) { |
| 256 throw new core.MojoApiError( | 267 throw new core.MojoApiError( |
| 257 "If an interface has no ServiceName, then one must be provided."); | 268 "If an interface has no ServiceName, then one must be provided."); |
| 258 } | 269 } |
| 259 s.connectToService(url, p, name); | 270 s.connectToService(url, p, name); |
| 260 return p; | 271 return p; |
| 261 } | 272 } |
| 262 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo
nseFactory = null]); | 273 void getNextLocation(LocationServiceUpdatePriority priority,void callback(loca
tion_mojom.Location location)); |
| 263 } | 274 } |
| 264 | 275 |
| 265 abstract class LocationServiceInterface | 276 abstract class LocationServiceInterface |
| 266 implements bindings.MojoInterface<LocationService>, | 277 implements bindings.MojoInterface<LocationService>, |
| 267 LocationService { | 278 LocationService { |
| 268 factory LocationServiceInterface([LocationService impl]) => | 279 factory LocationServiceInterface([LocationService impl]) => |
| 269 new LocationServiceStub.unbound(impl); | 280 new LocationServiceStub.unbound(impl); |
| 270 | 281 |
| 271 factory LocationServiceInterface.fromEndpoint( | 282 factory LocationServiceInterface.fromEndpoint( |
| 272 core.MojoMessagePipeEndpoint endpoint, | 283 core.MojoMessagePipeEndpoint endpoint, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 302 | 313 |
| 303 void handleResponse(bindings.ServiceMessage message) { | 314 void handleResponse(bindings.ServiceMessage message) { |
| 304 switch (message.header.type) { | 315 switch (message.header.type) { |
| 305 case _locationServiceMethodGetNextLocationName: | 316 case _locationServiceMethodGetNextLocationName: |
| 306 var r = LocationServiceGetNextLocationResponseParams.deserialize( | 317 var r = LocationServiceGetNextLocationResponseParams.deserialize( |
| 307 message.payload); | 318 message.payload); |
| 308 if (!message.header.hasRequestId) { | 319 if (!message.header.hasRequestId) { |
| 309 proxyError("Expected a message with a valid request Id."); | 320 proxyError("Expected a message with a valid request Id."); |
| 310 return; | 321 return; |
| 311 } | 322 } |
| 312 Completer c = completerMap[message.header.requestId]; | 323 Function callback = callbackMap[message.header.requestId]; |
| 313 if (c == null) { | 324 if (callback == null) { |
| 314 proxyError( | 325 proxyError( |
| 315 "Message had unknown request Id: ${message.header.requestId}"); | 326 "Message had unknown request Id: ${message.header.requestId}"); |
| 316 return; | 327 return; |
| 317 } | 328 } |
| 318 completerMap.remove(message.header.requestId); | 329 callbackMap.remove(message.header.requestId); |
| 319 if (c.isCompleted) { | 330 callback(r.location ); |
| 320 proxyError("Response completer already completed"); | |
| 321 return; | |
| 322 } | |
| 323 c.complete(r); | |
| 324 break; | 331 break; |
| 325 default: | 332 default: |
| 326 proxyError("Unexpected message type: ${message.header.type}"); | 333 proxyError("Unexpected message type: ${message.header.type}"); |
| 327 close(immediate: true); | 334 close(immediate: true); |
| 328 break; | 335 break; |
| 329 } | 336 } |
| 330 } | 337 } |
| 331 | 338 |
| 332 @override | 339 @override |
| 333 String toString() { | 340 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 358 return newMockedProxy; | 365 return newMockedProxy; |
| 359 } | 366 } |
| 360 | 367 |
| 361 static LocationServiceProxy newFromEndpoint( | 368 static LocationServiceProxy newFromEndpoint( |
| 362 core.MojoMessagePipeEndpoint endpoint) { | 369 core.MojoMessagePipeEndpoint endpoint) { |
| 363 assert(endpoint.setDescription("For LocationServiceProxy")); | 370 assert(endpoint.setDescription("For LocationServiceProxy")); |
| 364 return new LocationServiceProxy.fromEndpoint(endpoint); | 371 return new LocationServiceProxy.fromEndpoint(endpoint); |
| 365 } | 372 } |
| 366 | 373 |
| 367 | 374 |
| 368 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo
nseFactory = null]) { | 375 void getNextLocation(LocationServiceUpdatePriority priority,void callback(loca
tion_mojom.Location location)) { |
| 369 if (impl != null) { | 376 if (impl != null) { |
| 370 return new Future(() => impl.getNextLocation(priority,_LocationServiceStub
Control._locationServiceGetNextLocationResponseParamsFactory)); | 377 impl.getNextLocation(priority,callback); |
| 378 return; |
| 371 } | 379 } |
| 372 var params = new _LocationServiceGetNextLocationParams(); | 380 var params = new _LocationServiceGetNextLocationParams(); |
| 373 params.priority = priority; | 381 params.priority = priority; |
| 374 return ctrl.sendMessageWithRequestId( | 382 ctrl.sendMessageWithRequestId( |
| 375 params, | 383 params, |
| 376 _locationServiceMethodGetNextLocationName, | 384 _locationServiceMethodGetNextLocationName, |
| 377 -1, | 385 -1, |
| 378 bindings.MessageHeader.kMessageExpectsResponse); | 386 bindings.MessageHeader.kMessageExpectsResponse, |
| 387 callback); |
| 379 } | 388 } |
| 380 } | 389 } |
| 381 | 390 |
| 382 class _LocationServiceStubControl | 391 class _LocationServiceStubControl |
| 383 extends bindings.StubMessageHandler | 392 extends bindings.StubMessageHandler |
| 384 implements bindings.StubControl<LocationService> { | 393 implements bindings.StubControl<LocationService> { |
| 385 LocationService _impl; | 394 LocationService _impl; |
| 386 | 395 |
| 387 _LocationServiceStubControl.fromEndpoint( | 396 _LocationServiceStubControl.fromEndpoint( |
| 388 core.MojoMessagePipeEndpoint endpoint, [LocationService impl]) | 397 core.MojoMessagePipeEndpoint endpoint, [LocationService impl]) |
| 389 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 398 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 390 _impl = impl; | 399 _impl = impl; |
| 391 } | 400 } |
| 392 | 401 |
| 393 _LocationServiceStubControl.fromHandle( | 402 _LocationServiceStubControl.fromHandle( |
| 394 core.MojoHandle handle, [LocationService impl]) | 403 core.MojoHandle handle, [LocationService impl]) |
| 395 : super.fromHandle(handle, autoBegin: impl != null) { | 404 : super.fromHandle(handle, autoBegin: impl != null) { |
| 396 _impl = impl; | 405 _impl = impl; |
| 397 } | 406 } |
| 398 | 407 |
| 399 _LocationServiceStubControl.unbound([this._impl]) : super.unbound(); | 408 _LocationServiceStubControl.unbound([this._impl]) : super.unbound(); |
| 400 | 409 |
| 401 String get serviceName => LocationService.serviceName; | 410 String get serviceName => LocationService.serviceName; |
| 402 | 411 |
| 403 | 412 |
| 404 static LocationServiceGetNextLocationResponseParams _locationServiceGetNextLoc
ationResponseParamsFactory(location_mojom.Location location) { | 413 Function _locationServiceGetNextLocationResponseParamsResponder( |
| 405 var result = new LocationServiceGetNextLocationResponseParams(); | 414 int requestId) { |
| 406 result.location = location; | 415 return (location_mojom.Location location) { |
| 407 return result; | 416 var result = new LocationServiceGetNextLocationResponseParams(); |
| 417 result.location = location; |
| 418 sendResponse(buildResponseWithId( |
| 419 result, |
| 420 _locationServiceMethodGetNextLocationName, |
| 421 requestId, |
| 422 bindings.MessageHeader.kMessageIsResponse)); |
| 423 }; |
| 408 } | 424 } |
| 409 | 425 |
| 410 dynamic handleMessage(bindings.ServiceMessage message) { | 426 void handleMessage(bindings.ServiceMessage message) { |
| 411 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 427 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 412 return bindings.ControlMessageHandler.handleMessage(this, | 428 bindings.ControlMessageHandler.handleMessage( |
| 413 0, | 429 this, 0, message); |
| 414 message); | 430 return; |
| 415 } | 431 } |
| 416 if (_impl == null) { | 432 if (_impl == null) { |
| 417 throw new core.MojoApiError("$this has no implementation set"); | 433 throw new core.MojoApiError("$this has no implementation set"); |
| 418 } | 434 } |
| 419 switch (message.header.type) { | 435 switch (message.header.type) { |
| 420 case _locationServiceMethodGetNextLocationName: | 436 case _locationServiceMethodGetNextLocationName: |
| 421 var params = _LocationServiceGetNextLocationParams.deserialize( | 437 var params = _LocationServiceGetNextLocationParams.deserialize( |
| 422 message.payload); | 438 message.payload); |
| 423 var response = _impl.getNextLocation(params.priority,_locationServiceGet
NextLocationResponseParamsFactory); | 439 _impl.getNextLocation(params.priority, _locationServiceGetNextLocationRe
sponseParamsResponder(message.header.requestId)); |
| 424 if (response is Future) { | |
| 425 return response.then((response) { | |
| 426 if (response != null) { | |
| 427 return buildResponseWithId( | |
| 428 response, | |
| 429 _locationServiceMethodGetNextLocationName, | |
| 430 message.header.requestId, | |
| 431 bindings.MessageHeader.kMessageIsResponse); | |
| 432 } | |
| 433 }); | |
| 434 } else if (response != null) { | |
| 435 return buildResponseWithId( | |
| 436 response, | |
| 437 _locationServiceMethodGetNextLocationName, | |
| 438 message.header.requestId, | |
| 439 bindings.MessageHeader.kMessageIsResponse); | |
| 440 } | |
| 441 break; | 440 break; |
| 442 default: | 441 default: |
| 443 throw new bindings.MojoCodecError("Unexpected message name"); | 442 throw new bindings.MojoCodecError("Unexpected message name"); |
| 444 break; | 443 break; |
| 445 } | 444 } |
| 446 return null; | |
| 447 } | 445 } |
| 448 | 446 |
| 449 LocationService get impl => _impl; | 447 LocationService get impl => _impl; |
| 450 set impl(LocationService d) { | 448 set impl(LocationService d) { |
| 451 if (d == null) { | 449 if (d == null) { |
| 452 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 450 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 453 } | 451 } |
| 454 if (isBound && (_impl == null)) { | 452 if (isBound && (_impl == null)) { |
| 455 beginHandlingEvents(); | 453 beginHandlingEvents(); |
| 456 } | 454 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 core.MojoHandle handle, [LocationService impl]) | 488 core.MojoHandle handle, [LocationService impl]) |
| 491 : super(new _LocationServiceStubControl.fromHandle(handle, impl)); | 489 : super(new _LocationServiceStubControl.fromHandle(handle, impl)); |
| 492 | 490 |
| 493 static LocationServiceStub newFromEndpoint( | 491 static LocationServiceStub newFromEndpoint( |
| 494 core.MojoMessagePipeEndpoint endpoint) { | 492 core.MojoMessagePipeEndpoint endpoint) { |
| 495 assert(endpoint.setDescription("For LocationServiceStub")); | 493 assert(endpoint.setDescription("For LocationServiceStub")); |
| 496 return new LocationServiceStub.fromEndpoint(endpoint); | 494 return new LocationServiceStub.fromEndpoint(endpoint); |
| 497 } | 495 } |
| 498 | 496 |
| 499 | 497 |
| 500 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo
nseFactory = null]) { | 498 void getNextLocation(LocationServiceUpdatePriority priority,void callback(loca
tion_mojom.Location location)) { |
| 501 return impl.getNextLocation(priority,responseFactory); | 499 return impl.getNextLocation(priority,callback); |
| 502 } | 500 } |
| 503 } | 501 } |
| 504 | 502 |
| 505 | 503 |
| 506 | 504 |
| OLD | NEW |