Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: tools/grit/grit/format/policy_templates/writers/admx_writer.py

Issue 5958014: Policy: Add ProxyMode and deprecate ProxyServerMode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: check final diff Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1573d78719452b7b42f9f9683793d5402edeceee 100644
--- a/tools/grit/grit/format/policy_templates/writers/admx_writer.py
+++ b/tools/grit/grit/format/policy_templates/writers/admx_writer.py
@@ -157,11 +157,12 @@ class ADMXWriter(xml_formatted_writer.XMLFormattedWriter):
'valueName': name,
}
self.AddElement(parent, 'text', attributes)
-
- def _AddEnumPolicy(self, parent, name, items):
+ def _AddEnumPolicy(self, parent, policy):
'''Generates ADMX elements for an Enum-Policy and adds them to the
passed parent element.
'''
+ name = policy['name']
+ items = policy['items']
attributes = {
'id': name,
'valueName': name,
@@ -172,7 +173,11 @@ class ADMXWriter(xml_formatted_writer.XMLFormattedWriter):
item_elem = self.AddElement(enum_elem, 'item', attributes)
value_elem = self.AddElement(item_elem, 'value')
attributes = {'value': str(item['value'])}
- self.AddElement(value_elem, 'decimal', attributes)
+ if policy['type'] == 'int-enum':
+ element_type = 'decimal'
+ else:
+ element_type = 'string'
+ self.AddElement(value_elem, element_type, attributes)
def _AddListPolicy(self, parent, name):
'''Generates ADMX XML elements for a List-Policy and adds them to the
@@ -249,9 +254,9 @@ 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 in ('int-enum', 'string-enum'):
parent = self._GetElements(policy_elem)
- self._AddEnumPolicy(parent, policy_name, policy['items'])
+ self._AddEnumPolicy(parent, policy)
elif policy_type == 'list':
parent = self._GetElements(policy_elem)
self._AddListPolicy(parent, policy_name)

Powered by Google App Engine
This is Rietveld 408576698