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..2367a585e0b31bb0916ddaae618b2a215c95f279 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,32 @@ 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 %} |
+{% if should_gen_mojom_types -%} |
+{{ mojom_type_macros.writeMojomTypeDef(interface, typepkg, package) }} |
+{%- endif %} |
+ |
+class _{{interface|name}}ServiceDescription implements {{descpkg}}ServiceDescription { |
+{%- if should_gen_mojom_types %} |
+ dynamic getTopLevelInterface([Function responseFactory]) => |
+ _{{interface|mojom_type_identifier|lower_camel}}(); |
+ |
+ dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
+ getAllMojomTypeDefinitions()[typeKey]; |
+ |
+ dynamic getAllTypeDefinitions([Function responseFactory]) => |
+ getAllMojomTypeDefinitions(); |
+{%- else %} |
+ dynamic getTopLevelInterface([Function responseFactory]) => null; |
+ |
+ dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
+ |
+ dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
+{%- endif %} |
+} |
+ |
abstract class {{interface|name}} { |
{%- if interface.service_name %} |
static const String serviceName = "{{interface.service_name}}"; |
@@ -53,6 +76,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 +324,7 @@ class {{interface|name}}Stub extends bindings.Stub { |
} |
int get version => {{interface.version}}; |
+ |
+ {{descpkg}}ServiceDescription get serviceDescription => |
+ new _{{interface|name}}ServiceDescription(); |
} |