Index: mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
diff --git a/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
index c8c10cd86b9001dc14e0fa72bb02c03395cdb18e..e53258ce54ab31c37d84fe49d2246b2e33a6d708 100644 |
--- a/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
@@ -5,9 +5,35 @@ const int _{{interface|name}}_{{method|name}}Name = {{method.ordinal}}; |
{#--- Interface Enums #} |
{%- from "enum_definition.tmpl" import enum_def -%} |
{%- for enum in interface.enums %} |
- {{ enum_def(enum) }} |
+ {{ enum_def(enum, typepkg, package) }} |
{%- endfor %} |
+{{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} |
+ |
+class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescription { |
+{% if should_gen_mojom_types -%} |
+ dynamic getTopLevelInterface([Function responseFactory = null]) { |
+ return {{interface|mojom_type_identifier}}(); |
+ } |
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions()[typeKey]; |
+ } |
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions(); |
+ } |
+{%- else -%} |
+ dynamic getTopLevelInterface([Function responseFactory = null]) { |
+ return null; |
+ } |
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
+ return null; |
+ } |
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
+ return null; |
+ } |
+{%- endif %} |
+} |
+ |
abstract class {{interface|name}} { |
{%- if interface.service_name %} |
static const String serviceName = "{{interface.service_name}}"; |
@@ -53,6 +79,9 @@ class _{{interface|name}}ProxyImpl extends bindings.Proxy { |
return new _{{interface|name}}ProxyImpl.fromEndpoint(endpoint); |
} |
+ {{descpkg}}ServiceDescription get serviceDescription => |
+ new _{{interface|name}}ServiceDescription(); |
+ |
void handleResponse(bindings.ServiceMessage message) { |
switch (message.header.type) { |
{%- for method in interface.methods %} |
@@ -298,4 +327,8 @@ class {{interface|name}}Stub extends bindings.Stub { |
} |
int get version => {{interface.version}}; |
+ |
+ |
+ {{descpkg}}ServiceDescription get serviceDescription => |
+ new _{{interface|name}}ServiceDescription(); |
} |