| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for the system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 dart:html APIs from the IDL database.""" | 7 dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| 11 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ | 11 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ |
| 12 IsPureInterface, TypeOrNothing, GetAnnotationsAndComments, \ | 12 IsPureInterface, TypeOrNothing, GetAnnotationsAndComments, \ |
| 13 FormatAnnotationsAndComments, ConvertToFuture, GetCallbackInfo | 13 FormatAnnotationsAndComments, ConvertToFuture, GetCallbackInfo |
| 14 from htmlrenamer import convert_to_future_members | 14 from htmlrenamer import convert_to_future_members |
| 15 | 15 |
| 16 # Types that are accessible cross-frame in a limited fashion. | 16 # Types that are accessible cross-frame in a limited fashion. |
| 17 # In these cases, the base type (e.g., WindowBase) provides restricted access | 17 # In these cases, the base type (e.g., WindowBase) provides restricted access |
| 18 # while the subtype (e.g., Window) provides full access to the | 18 # while the subtype (e.g., Window) provides full access to the |
| 19 # corresponding objects if there are from the same frame. | 19 # corresponding objects if there are from the same frame. |
| 20 _secure_base_types = { | 20 _secure_base_types = { |
| 21 'Window': 'WindowBase', | 21 'Window': 'WindowBase', |
| 22 'Location': 'LocationBase', | 22 'Location': 'LocationBase', |
| 23 'History': 'HistoryBase', | 23 'History': 'HistoryBase', |
| 24 } | 24 } |
| 25 | 25 |
| 26 _custom_factories = { | 26 _custom_factories = [ |
| 27 'Notification', | 27 'Notification', |
| 28 'EventSource', | 28 'EventSource', |
| 29 } | 29 ] |
| 30 | 30 |
| 31 class HtmlDartGenerator(object): | 31 class HtmlDartGenerator(object): |
| 32 def __init__(self, interface, options): | 32 def __init__(self, interface, options): |
| 33 self._database = options.database | 33 self._database = options.database |
| 34 self._interface = interface | 34 self._interface = interface |
| 35 self._type_registry = options.type_registry | 35 self._type_registry = options.type_registry |
| 36 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) | 36 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) |
| 37 self._renamer = options.renamer | 37 self._renamer = options.renamer |
| 38 self._library_name = self._renamer.GetLibraryName(self._interface) | 38 self._library_name = self._renamer.GetLibraryName(self._interface) |
| 39 | 39 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 walk(interface.parents) | 651 walk(interface.parents) |
| 652 else: | 652 else: |
| 653 walk(interface.parents[1:]) | 653 walk(interface.parents[1:]) |
| 654 return result | 654 return result |
| 655 | 655 |
| 656 def _DartType(self, type_name): | 656 def _DartType(self, type_name): |
| 657 return self._type_registry.DartType(type_name) | 657 return self._type_registry.DartType(type_name) |
| 658 | 658 |
| 659 def _IsPrivate(self, name): | 659 def _IsPrivate(self, name): |
| 660 return name.startswith('_') | 660 return name.startswith('_') |
| OLD | NEW |