Index: sdk/lib/html/scripts/systemnative.py |
diff --git a/sdk/lib/html/scripts/systemnative.py b/sdk/lib/html/scripts/systemnative.py |
index 55477de15cb4c4366b78a1a5a8615e10aebda335..7155f29183a78748b268d39ed9811e4e4bbd0a75 100644 |
--- a/sdk/lib/html/scripts/systemnative.py |
+++ b/sdk/lib/html/scripts/systemnative.py |
@@ -10,11 +10,14 @@ import emitter |
import os |
from generator import * |
from systemhtml import SecureOutputType |
+from htmldartgenerator import * |
-class DartiumBackend(object): |
+class DartiumBackend(HtmlDartGenerator): |
"""Generates Dart implementation for one DOM IDL interface.""" |
def __init__(self, interface, cpp_library_emitter, options): |
+ super(DartiumBackend, self).__init__(interface, options) |
+ |
self._interface = interface |
self._cpp_library_emitter = cpp_library_emitter |
self._database = options.database |
@@ -104,9 +107,6 @@ class DartiumBackend(object): |
def RootClassName(self): |
return 'NativeFieldWrapperClass1' |
- def AdditionalImplementedInterfaces(self): |
- return [] |
- |
def NativeSpec(self): |
return '' |
@@ -209,6 +209,20 @@ class DartiumBackend(object): |
ARGUMENTS=constructor_info.ParametersAsArgumentList(), |
NATIVE_NAME=native_binding) |
+ def AddConstructors(self, constructors, factory_provider, class_name, |
+ base_class): |
+ super(DartiumBackend, self).AddConstructors(constructors, factory_provider, |
+ class_name, base_class) |
+ |
+ super_constructor = '' |
+ if base_class and base_class != 'NativeFieldWrapperClass1': |
+ super_constructor = ': super.internal()' |
+ |
+ self._members_emitter.Emit( |
+ ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', |
+ CLASSNAME=class_name, |
+ SUPERCONSTRUCTOR=super_constructor) |
+ |
def FinishInterface(self): |
self._GenerateCPPHeader() |
@@ -462,6 +476,13 @@ class DartiumBackend(object): |
else: |
self._GenerateDispatcher(info.operations, dart_declaration, [info.name for info in info.param_infos]) |
+ def AddConstant(self, constant): |
+ type = TypeOrNothing(self._DartType(constant.type.id), constant.type.id) |
+ self._members_emitter.Emit('\n static const $TYPE$NAME = $VALUE;\n', |
+ NAME=constant.id, |
+ TYPE=type, |
+ VALUE=constant.value) |
+ |
def _GenerateDispatcher(self, operations, dart_declaration, argument_names): |
body = self._members_emitter.Emit( |
@@ -757,8 +778,12 @@ class DartiumBackend(object): |
native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) |
self._members_emitter.Emit( |
'\n' |
- ' $DART_DECLARATION native "$NATIVE_BINDING";\n', |
- DART_DECLARATION=dart_declaration, NATIVE_BINDING=native_binding) |
+ '\n /** @domName $DOMINTERFACE.$DOMNAME */' |
+ '\n $DART_DECLARATION native "$NATIVE_BINDING";\n', |
+ DOMINTERFACE=self._interface.id, |
+ DOMNAME=idl_name, |
+ DART_DECLARATION=dart_declaration, |
+ NATIVE_BINDING=native_binding) |
cpp_callback_name = '%s%s' % (idl_name, native_suffix) |
self._cpp_resolver_emitter.Emit( |