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 5960c4a336bf8a39cfaaf2d3a58c8e6cd0e9ae92..4398d66f45156a41ad376bbb9a7a927cc4008de6 100644 |
--- a/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl |
@@ -8,9 +8,37 @@ const String {{interface|name}}Name = |
{#--- 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 extends {{descpkg}}ServiceDescription { |
zra
2015/11/24 17:34:44
Should this be extends or implements?
alexfandrianto
2015/12/18 01:53:19
It doesn't matter, but I think the preference was
|
+ // Avoid infinite loop by overriding serviceDescription field. |
zra
2015/11/24 17:34:44
I don't understand this comment.
alexfandrianto
2015/12/18 01:53:19
It's not needed anymore.
|
+ final {{descpkg}}ServiceDescription serviceDescription = null; |
+{% 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}} { |
{%- for method in interface.methods %} |
{%- if method.response_parameters == None %} |
@@ -53,6 +81,9 @@ class {{interface|name}}ProxyImpl extends bindings.Proxy { |
String get name => {{interface|name}}Name; |
+ {{descpkg}}ServiceDescription get serviceDescription => |
+ new _{{interface|name}}ServiceDescription(); |
+ |
void handleResponse(bindings.ServiceMessage message) { |
switch (message.header.type) { |
{%- for method in interface.methods %} |
@@ -300,4 +331,7 @@ class {{interface|name}}Stub extends bindings.Stub { |
} |
int get version => {{interface.version}}; |
+ |
+ {{descpkg}}ServiceDescription get serviceDescription => |
+ new _{{interface|name}}ServiceDescription(); |
} |