Index: mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart |
diff --git a/mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart b/mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart |
index 60d7ab53df55c8788ebcdb6237bbc1e1f995e1a3..f7c55d060742af581b67c6dc0f427818db5bc401 100644 |
--- a/mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart |
+++ b/mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart |
@@ -8,6 +8,9 @@ import 'dart:async'; |
import 'package:mojo/bindings.dart' as bindings; |
import 'package:mojo/core.dart' as core; |
+import 'package:mojo/mojo/mojom_types.mojom.dart' as mojom_types; |
+import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
+import 'package:mojo/mojo/application_connector.mojom.dart' as application_connector_mojom; |
import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom; |
@@ -93,13 +96,159 @@ class ShellConnectToApplicationParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _shell_Shell_ConnectToApplication_Params__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ShellConnectToApplicationParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ApplicationUrl') |
+ ..type = (new mojom_types.Type() |
+..stringType = (new mojom_types.StringType()..nullable = false)), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Services') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..isInterfaceRequest = true |
+ ..identifier = '_service_provider_ServiceProvider__' |
+ ..typeKey = '_service_provider_ServiceProvider__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ExposedServices') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_service_provider_ServiceProvider__' |
+ ..typeKey = '_service_provider_ServiceProvider__' |
+ )), |
+ ]; |
+} |
+ |
+ |
+class ShellCreateApplicationConnectorParams extends bindings.Struct { |
+ static const List<bindings.StructDataHeader> kVersions = const [ |
+ const bindings.StructDataHeader(16, 0) |
+ ]; |
+ Object applicationConnectorRequest = null; |
+ |
+ ShellCreateApplicationConnectorParams() : super(kVersions.last.size); |
+ |
+ static ShellCreateApplicationConnectorParams deserialize(bindings.Message message) { |
+ var decoder = new bindings.Decoder(message); |
+ var result = decode(decoder); |
+ if (decoder.excessHandles != null) { |
+ decoder.excessHandles.forEach((h) => h.close()); |
+ } |
+ return result; |
+ } |
+ |
+ static ShellCreateApplicationConnectorParams decode(bindings.Decoder decoder0) { |
+ if (decoder0 == null) { |
+ return null; |
+ } |
+ ShellCreateApplicationConnectorParams result = new ShellCreateApplicationConnectorParams(); |
+ |
+ var mainDataHeader = decoder0.decodeStructDataHeader(); |
+ if (mainDataHeader.version <= kVersions.last.version) { |
+ // Scan in reverse order to optimize for more recent versions. |
+ for (int i = kVersions.length - 1; i >= 0; --i) { |
+ if (mainDataHeader.version >= kVersions[i].version) { |
+ if (mainDataHeader.size == kVersions[i].size) { |
+ // Found a match. |
+ break; |
+ } |
+ throw new bindings.MojoCodecError( |
+ 'Header size doesn\'t correspond to known version size.'); |
+ } |
+ } |
+ } else if (mainDataHeader.size < kVersions.last.size) { |
+ throw new bindings.MojoCodecError( |
+ 'Message newer than the last known version cannot be shorter than ' |
+ 'required by the last known version.'); |
+ } |
+ if (mainDataHeader.version >= 0) { |
+ |
+ result.applicationConnectorRequest = decoder0.decodeInterfaceRequest(8, false, application_connector_mojom.ApplicationConnectorStub.newFromEndpoint); |
+ } |
+ return result; |
+ } |
+ |
+ void encode(bindings.Encoder encoder) { |
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
+ |
+ encoder0.encodeInterfaceRequest(applicationConnectorRequest, 8, false); |
+ } |
+ |
+ String toString() { |
+ return "ShellCreateApplicationConnectorParams(" |
+ "applicationConnectorRequest: $applicationConnectorRequest" ")"; |
+ } |
+ |
+ Map toJson() { |
+ throw new bindings.MojoCodecError( |
+ 'Object containing handles cannot be encoded to JSON.'); |
+ } |
+} |
+ |
+mojom_types.MojomStruct _shell_Shell_CreateApplicationConnector_Params__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ShellCreateApplicationConnectorParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ApplicationConnectorRequest') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..isInterfaceRequest = true |
+ ..identifier = '_application_connector_ApplicationConnector__' |
+ ..typeKey = '_application_connector_ApplicationConnector__' |
+ )), |
+ ]; |
+} |
+ |
+ |
const int kShell_connectToApplication_name = 0; |
+const int kShell_createApplicationConnector_name = 1; |
const String ShellName = |
'mojo::Shell'; |
+mojom_types.MojomInterface _shell_Shell__() { |
+ return new mojom_types.MojomInterface() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "Shell") |
+ ..interfaceName = "Shell" |
+ ..methods = <int, mojom_types.MojomMethod>{ |
+kShell_connectToApplication_name: new mojom_types.MojomMethod() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "ConnectToApplication") |
+ ..ordinal = kShell_connectToApplication_name..parameters = _shell_Shell_ConnectToApplication_Params__(),kShell_createApplicationConnector_name: new mojom_types.MojomMethod() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "CreateApplicationConnector") |
+ ..ordinal = kShell_createApplicationConnector_name..parameters = _shell_Shell_CreateApplicationConnector_Params__(), |
+ }; |
+} |
+ |
+class _ShellServiceDescription extends service_describer.ServiceDescription { |
+ // Avoid infinite loop by overriding serviceDescription field. |
+ final service_describer.ServiceDescription serviceDescription = null; |
+dynamic getTopLevelInterface([Function responseFactory = null]) { |
+ return _shell_Shell__(); |
+ } |
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions()[typeKey]; |
+ } |
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions(); |
+ } |
+} |
+ |
abstract class Shell { |
void connectToApplication(String applicationUrl, Object services, Object exposedServices); |
+ void createApplicationConnector(Object applicationConnectorRequest); |
} |
@@ -121,6 +270,9 @@ class ShellProxyImpl extends bindings.Proxy { |
String get name => ShellName; |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _ShellServiceDescription(); |
+ |
void handleResponse(bindings.ServiceMessage message) { |
switch (message.header.type) { |
default: |
@@ -153,6 +305,16 @@ class _ShellProxyCalls implements Shell { |
_proxyImpl.sendMessage(params, kShell_connectToApplication_name); |
} |
+ void createApplicationConnector(Object applicationConnectorRequest) { |
+ if (!_proxyImpl.isBound) { |
+ _proxyImpl.proxyError("The Proxy is closed."); |
+ return; |
+ } |
+ var params = new ShellCreateApplicationConnectorParams(); |
+ params.applicationConnectorRequest = applicationConnectorRequest; |
+ _proxyImpl.sendMessage(params, kShell_createApplicationConnector_name); |
+ } |
+ |
} |
@@ -249,6 +411,11 @@ class ShellStub extends bindings.Stub { |
message.payload); |
_impl.connectToApplication(params.applicationUrl, params.services, params.exposedServices); |
break; |
+ case kShell_createApplicationConnector_name: |
+ var params = ShellCreateApplicationConnectorParams.deserialize( |
+ message.payload); |
+ _impl.createApplicationConnector(params.applicationConnectorRequest); |
+ break; |
default: |
throw new bindings.MojoCodecError("Unexpected message name"); |
break; |
@@ -268,6 +435,58 @@ class ShellStub extends bindings.Stub { |
} |
int get version => 0; |
+ |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _ShellServiceDescription(); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+var _MojomDesc__ = _initDescriptions(); |
+ |
+Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
+ var map = new Map<String, mojom_types.UserDefinedType>(); |
+ |
+ map["_shell_Shell_ConnectToApplication_Params__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _shell_Shell_ConnectToApplication_Params__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_shell_Shell_CreateApplicationConnector_Params__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _shell_Shell_CreateApplicationConnector_Params__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_shell_Shell__"] = |
+ new mojom_types.UserDefinedType() |
+ ..interfaceType = _shell_Shell__(); |
+ |
+application_connector_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_types.UserDefinedType udt) { |
+ map[s] = udt; |
+}); |
+service_provider_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_types.UserDefinedType udt) { |
+ map[s] = udt; |
+}); |
+ return map; |
+} |
+ |
+Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
+ return _MojomDesc__; |
} |