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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 self._active_recommended_policy_group_name = \ | 342 self._active_recommended_policy_group_name = \ |
343 self.config['win_recommended_category_path'][-1] | 343 self.config['win_recommended_category_path'][-1] |
344 | 344 |
345 def BeginTemplate(self): | 345 def BeginTemplate(self): |
346 '''Generates the skeleton of the ADMX template. An ADMX template contains | 346 '''Generates the skeleton of the ADMX template. An ADMX template contains |
347 an ADMX "PolicyDefinitions" element with four child nodes: "policies" | 347 an ADMX "PolicyDefinitions" element with four child nodes: "policies" |
348 "policyNamspaces", "resources", "supportedOn" and "categories" | 348 "policyNamspaces", "resources", "supportedOn" and "categories" |
349 ''' | 349 ''' |
350 dom_impl = minidom.getDOMImplementation('') | 350 dom_impl = minidom.getDOMImplementation('') |
351 self._doc = dom_impl.createDocument(None, 'policyDefinitions', None) | 351 self._doc = dom_impl.createDocument(None, 'policyDefinitions', None) |
352 if self._GetChromiumVersionString() is not None: | |
353 self.AddComment(self._doc.documentElement, self.config['build'] + ''' vers ion: ''' + self._GetChromiumVersionString()) | |
pastarmovj
2014/10/07 14:54:35
Line too long.
cschuet1
2014/10/07 15:42:45
Done.
| |
352 policy_definitions_elem = self._doc.documentElement | 354 policy_definitions_elem = self._doc.documentElement |
353 | 355 |
354 policy_definitions_elem.attributes['revision'] = '1.0' | 356 policy_definitions_elem.attributes['revision'] = '1.0' |
355 policy_definitions_elem.attributes['schemaVersion'] = '1.0' | 357 policy_definitions_elem.attributes['schemaVersion'] = '1.0' |
356 | 358 |
357 self._AddPolicyNamespaces(policy_definitions_elem, | 359 self._AddPolicyNamespaces(policy_definitions_elem, |
358 self.config['admx_prefix'], | 360 self.config['admx_prefix'], |
359 self.config['admx_namespace']) | 361 self.config['admx_namespace']) |
360 self.AddElement(policy_definitions_elem, 'resources', | 362 self.AddElement(policy_definitions_elem, 'resources', |
361 {'minRequiredRevision' : '1.0'}) | 363 {'minRequiredRevision' : '1.0'}) |
362 self._AddSupportedOn(policy_definitions_elem, | 364 self._AddSupportedOn(policy_definitions_elem, |
363 self.config['win_supported_os']) | 365 self.config['win_supported_os']) |
364 self._categories_elem = self.AddElement(policy_definitions_elem, | 366 self._categories_elem = self.AddElement(policy_definitions_elem, |
365 'categories') | 367 'categories') |
366 self._AddCategories(self.config['win_mandatory_category_path']) | 368 self._AddCategories(self.config['win_mandatory_category_path']) |
367 self._AddCategories(self.config['win_recommended_category_path']) | 369 self._AddCategories(self.config['win_recommended_category_path']) |
368 self._active_policies_elem = self.AddElement(policy_definitions_elem, | 370 self._active_policies_elem = self.AddElement(policy_definitions_elem, |
369 'policies') | 371 'policies') |
370 self._active_mandatory_policy_group_name = \ | 372 self._active_mandatory_policy_group_name = \ |
371 self.config['win_mandatory_category_path'][-1] | 373 self.config['win_mandatory_category_path'][-1] |
372 self._active_recommended_policy_group_name = \ | 374 self._active_recommended_policy_group_name = \ |
373 self.config['win_recommended_category_path'][-1] | 375 self.config['win_recommended_category_path'][-1] |
374 | 376 |
375 def GetTemplateText(self): | 377 def GetTemplateText(self): |
376 return self.ToPrettyXml(self._doc) | 378 return self.ToPrettyXml(self._doc) |
OLD | NEW |