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'] + \ |
| 354 ' version: ' + self._GetChromiumVersionString()) |
352 policy_definitions_elem = self._doc.documentElement | 355 policy_definitions_elem = self._doc.documentElement |
353 | 356 |
354 policy_definitions_elem.attributes['revision'] = '1.0' | 357 policy_definitions_elem.attributes['revision'] = '1.0' |
355 policy_definitions_elem.attributes['schemaVersion'] = '1.0' | 358 policy_definitions_elem.attributes['schemaVersion'] = '1.0' |
356 | 359 |
357 self._AddPolicyNamespaces(policy_definitions_elem, | 360 self._AddPolicyNamespaces(policy_definitions_elem, |
358 self.config['admx_prefix'], | 361 self.config['admx_prefix'], |
359 self.config['admx_namespace']) | 362 self.config['admx_namespace']) |
360 self.AddElement(policy_definitions_elem, 'resources', | 363 self.AddElement(policy_definitions_elem, 'resources', |
361 {'minRequiredRevision' : '1.0'}) | 364 {'minRequiredRevision' : '1.0'}) |
362 self._AddSupportedOn(policy_definitions_elem, | 365 self._AddSupportedOn(policy_definitions_elem, |
363 self.config['win_supported_os']) | 366 self.config['win_supported_os']) |
364 self._categories_elem = self.AddElement(policy_definitions_elem, | 367 self._categories_elem = self.AddElement(policy_definitions_elem, |
365 'categories') | 368 'categories') |
366 self._AddCategories(self.config['win_mandatory_category_path']) | 369 self._AddCategories(self.config['win_mandatory_category_path']) |
367 self._AddCategories(self.config['win_recommended_category_path']) | 370 self._AddCategories(self.config['win_recommended_category_path']) |
368 self._active_policies_elem = self.AddElement(policy_definitions_elem, | 371 self._active_policies_elem = self.AddElement(policy_definitions_elem, |
369 'policies') | 372 'policies') |
370 self._active_mandatory_policy_group_name = \ | 373 self._active_mandatory_policy_group_name = \ |
371 self.config['win_mandatory_category_path'][-1] | 374 self.config['win_mandatory_category_path'][-1] |
372 self._active_recommended_policy_group_name = \ | 375 self._active_recommended_policy_group_name = \ |
373 self.config['win_recommended_category_path'][-1] | 376 self.config['win_recommended_category_path'][-1] |
374 | 377 |
375 def GetTemplateText(self): | 378 def GetTemplateText(self): |
376 return self.ToPrettyXml(self._doc) | 379 return self.ToPrettyXml(self._doc) |
OLD | NEW |