Chromium Code Reviews| Index: Source/bindings/scripts/idl_definitions.py |
| diff --git a/Source/bindings/scripts/idl_definitions.py b/Source/bindings/scripts/idl_definitions.py |
| index 179f587f6a6c17a3f059ed99b21c624737426509..07477857e2e9672ab9b1f5adc93492bfd88a09a4 100644 |
| --- a/Source/bindings/scripts/idl_definitions.py |
| +++ b/Source/bindings/scripts/idl_definitions.py |
| @@ -650,6 +650,16 @@ class IdlImplement(object): |
| # Extended attributes |
| ################################################################################ |
| +class Exposure: |
| + '''An Exposure holds one Exposed or RuntimeEnabled condition. |
|
Jens Widell
2014/12/09 11:30:31
Nit: Change to """ here as well.
The Google Pytho
yhirano
2014/12/09 11:59:13
Done.
|
| + Each exposure has two property: exposed and runtime_enabled. Exposed(e, r) |
|
Jens Widell
2014/12/09 11:30:31
Nit: "Exposed(e, r)" => "Exposure(e, r)"
yhirano
2014/12/09 11:59:13
Done.
|
| + corresponds to [Exposed(e r)]. Exposure(e) corresponds to [Exposed=e]. |
| + ''' |
| + def __init__(self, exposed, runtime_enabled=None): |
| + self.exposed = exposed |
| + self.runtime_enabled = runtime_enabled |
| + |
| + |
| def ext_attributes_node_to_extended_attributes(idl_name, node): |
| """ |
| Returns: |
| @@ -706,6 +716,21 @@ def ext_attributes_node_to_extended_attributes(idl_name, node): |
| if child_class != 'Arguments': |
| raise ValueError('[SetWrapperReferenceTo] only supports Arguments as child, but has child of class: %s' % child_class) |
| extended_attributes[name] = arguments_node_to_arguments(idl_name, child) |
| + elif name == 'Exposed': |
| + if child_class and child_class != 'Arguments': |
| + raise ValueError('[Exposed] only supports Arguments as child, but has child of class: %s' % child_class) |
| + exposures = [] |
| + if child_class == 'Arguments': |
| + exposures = [Exposure(exposed=str(arg.idl_type), |
| + runtime_enabled=arg.name) |
| + for arg in arguments_node_to_arguments('*', child)] |
| + else: |
| + value = extended_attribute_node.GetProperty('VALUE') |
| + if type(value) is str: |
| + exposures = [Exposure(exposed=value)] |
| + else: |
| + exposures = [Exposure(exposed=v) for v in value] |
| + extended_attributes[name] = exposures |
| elif child: |
| raise ValueError('ExtAttributes node with unexpected children: %s' % name) |
| else: |