Chromium Code Reviews| Index: tools/grit/grit/format/policy_templates/writers/admx_writer.py |
| diff --git a/tools/grit/grit/format/policy_templates/writers/admx_writer.py b/tools/grit/grit/format/policy_templates/writers/admx_writer.py |
| index 164175bdfed40b28570eaef21a9eebc55ea7ed37..cc6df2f88b67ad44140bd4cd79a6deaa7b6ea01a 100644 |
| --- a/tools/grit/grit/format/policy_templates/writers/admx_writer.py |
| +++ b/tools/grit/grit/format/policy_templates/writers/admx_writer.py |
| @@ -158,8 +158,8 @@ class ADMXWriter(xml_formatted_writer.XMLFormattedWriter): |
| } |
| self.AddElement(parent, 'text', attributes) |
| - def _AddEnumPolicy(self, parent, name, items): |
| - '''Generates ADMX elements for an Enum-Policy and adds them to the |
| + def _AddIntEnumPolicy(self, parent, name, items): |
|
gfeher
2011/01/03 10:30:10
Merge with the next function?
danno
2011/01/07 12:24:25
Done.
|
| + '''Generates ADMX elements for an integer Enum-Policy and adds them to the |
| passed parent element. |
| ''' |
| attributes = { |
| @@ -174,6 +174,22 @@ class ADMXWriter(xml_formatted_writer.XMLFormattedWriter): |
| attributes = {'value': str(item['value'])} |
| self.AddElement(value_elem, 'decimal', attributes) |
| + def _AddStringEnumPolicy(self, parent, name, items): |
| + '''Generates ADMX elements for an string Enum-Policy and adds them to the |
| + passed parent element. |
| + ''' |
| + attributes = { |
| + 'id': name, |
| + 'valueName': name, |
| + } |
| + enum_elem = self.AddElement(parent, 'enum', attributes) |
| + for item in items: |
| + attributes = {'displayName': self._AdmlString(item['name'])} |
| + item_elem = self.AddElement(enum_elem, 'item', attributes) |
| + value_elem = self.AddElement(item_elem, 'value') |
| + attributes = {'value': str(item['value'])} |
| + self.AddElement(value_elem, 'string', attributes) |
| + |
| def _AddListPolicy(self, parent, name): |
| '''Generates ADMX XML elements for a List-Policy and adds them to the |
| passed parent element. |
| @@ -249,9 +265,12 @@ class ADMXWriter(xml_formatted_writer.XMLFormattedWriter): |
| elif policy_type == 'string': |
| parent = self._GetElements(policy_elem) |
| self._AddStringPolicy(parent, policy_name) |
| - elif policy_type == 'enum': |
| + elif policy_type == 'int-enum': |
| + parent = self._GetElements(policy_elem) |
| + self._AddIntEnumPolicy(parent, policy_name, policy['items']) |
| + elif policy_type == 'string-enum': |
| parent = self._GetElements(policy_elem) |
| - self._AddEnumPolicy(parent, policy_name, policy['items']) |
| + self._AddStringEnumPolicy(parent, policy_name, policy['items']) |
| elif policy_type == 'list': |
| parent = self._GetElements(policy_elem) |
| self._AddListPolicy(parent, policy_name) |