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

Side by Side Diff: grit/format/policy_templates/writers/admx_writer.py

Issue 347293003: Added support for string-enum-list. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from xml.dom import minidom 6 from xml.dom import minidom
7 from grit.format.policy_templates.writers import xml_formatted_writer 7 from grit.format.policy_templates.writers import xml_formatted_writer
8 8
9 9
10 def GetWriter(config): 10 def GetWriter(config):
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 elif policy_type in ('string', 'dict'): 279 elif policy_type in ('string', 'dict'):
280 # 'dict' policies are configured as JSON-encoded strings on Windows. 280 # 'dict' policies are configured as JSON-encoded strings on Windows.
281 parent = self._GetElements(policy_elem) 281 parent = self._GetElements(policy_elem)
282 self._AddStringPolicy(parent, policy_name) 282 self._AddStringPolicy(parent, policy_name)
283 elif policy_type == 'int': 283 elif policy_type == 'int':
284 parent = self._GetElements(policy_elem) 284 parent = self._GetElements(policy_elem)
285 self._AddIntPolicy(parent, policy_name) 285 self._AddIntPolicy(parent, policy_name)
286 elif policy_type in ('int-enum', 'string-enum'): 286 elif policy_type in ('int-enum', 'string-enum'):
287 parent = self._GetElements(policy_elem) 287 parent = self._GetElements(policy_elem)
288 self._AddEnumPolicy(parent, policy) 288 self._AddEnumPolicy(parent, policy)
289 elif policy_type == 'list': 289 elif policy_type in ('list', 'string-enum-list'):
290 parent = self._GetElements(policy_elem) 290 parent = self._GetElements(policy_elem)
291 self._AddListPolicy(parent, key, policy_name) 291 self._AddListPolicy(parent, key, policy_name)
292 elif policy_type == 'group': 292 elif policy_type == 'group':
293 pass 293 pass
294 else: 294 else:
295 raise Exception('Unknown policy type %s.' % policy_type) 295 raise Exception('Unknown policy type %s.' % policy_type)
296 296
297 def WritePolicy(self, policy): 297 def WritePolicy(self, policy):
298 self._WritePolicy(policy, 298 self._WritePolicy(policy,
299 policy['name'], 299 policy['name'],
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 self._AddCategories(self.config['win_recommended_category_path']) 366 self._AddCategories(self.config['win_recommended_category_path'])
367 self._active_policies_elem = self.AddElement(policy_definitions_elem, 367 self._active_policies_elem = self.AddElement(policy_definitions_elem,
368 'policies') 368 'policies')
369 self._active_mandatory_policy_group_name = \ 369 self._active_mandatory_policy_group_name = \
370 self.config['win_mandatory_category_path'][-1] 370 self.config['win_mandatory_category_path'][-1]
371 self._active_recommended_policy_group_name = \ 371 self._active_recommended_policy_group_name = \
372 self.config['win_recommended_category_path'][-1] 372 self.config['win_recommended_category_path'][-1]
373 373
374 def GetTemplateText(self): 374 def GetTemplateText(self):
375 return self.ToPrettyXml(self._doc) 375 return self.ToPrettyXml(self._doc)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698