OLD | NEW |
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 self._AddEnumPolicy(parent, policy) | 288 self._AddEnumPolicy(parent, policy) |
289 elif policy_type in ('list', 'string-enum-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 if self.CanBeMandatory(policy): |
299 policy['name'], | 299 self._WritePolicy(policy, |
300 self.config['win_reg_mandatory_key_name'], | 300 policy['name'], |
301 self._active_mandatory_policy_group_name) | 301 self.config['win_reg_mandatory_key_name'], |
| 302 self._active_mandatory_policy_group_name) |
302 | 303 |
303 def WriteRecommendedPolicy(self, policy): | 304 def WriteRecommendedPolicy(self, policy): |
304 self._WritePolicy(policy, | 305 self._WritePolicy(policy, |
305 policy['name'] + '_recommended', | 306 policy['name'] + '_recommended', |
306 self.config['win_reg_recommended_key_name'], | 307 self.config['win_reg_recommended_key_name'], |
307 self._active_recommended_policy_group_name) | 308 self._active_recommended_policy_group_name) |
308 | 309 |
309 def _BeginPolicyGroup(self, group, name, parent): | 310 def _BeginPolicyGroup(self, group, name, parent): |
310 '''Generates ADMX elements for a Policy-Group. | 311 '''Generates ADMX elements for a Policy-Group. |
311 ''' | 312 ''' |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 self._AddCategories(self.config['win_recommended_category_path']) | 367 self._AddCategories(self.config['win_recommended_category_path']) |
367 self._active_policies_elem = self.AddElement(policy_definitions_elem, | 368 self._active_policies_elem = self.AddElement(policy_definitions_elem, |
368 'policies') | 369 'policies') |
369 self._active_mandatory_policy_group_name = \ | 370 self._active_mandatory_policy_group_name = \ |
370 self.config['win_mandatory_category_path'][-1] | 371 self.config['win_mandatory_category_path'][-1] |
371 self._active_recommended_policy_group_name = \ | 372 self._active_recommended_policy_group_name = \ |
372 self.config['win_recommended_category_path'][-1] | 373 self.config['win_recommended_category_path'][-1] |
373 | 374 |
374 def GetTemplateText(self): | 375 def GetTemplateText(self): |
375 return self.ToPrettyXml(self._doc) | 376 return self.ToPrettyXml(self._doc) |
OLD | NEW |