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

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

Issue 631223003: Include chromium version number in policy templates (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 2 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 self.config['win_mandatory_category_path'][0], 154 self.config['win_mandatory_category_path'][0],
155 self.config['app_name']) 155 self.config['app_name'])
156 self._AddString(string_table_elem, 156 self._AddString(string_table_elem,
157 self.config['win_recommended_category_path'][0], 157 self.config['win_recommended_category_path'][0],
158 recommended_name) 158 recommended_name)
159 159
160 def BeginTemplate(self): 160 def BeginTemplate(self):
161 dom_impl = minidom.getDOMImplementation('') 161 dom_impl = minidom.getDOMImplementation('')
162 self._doc = dom_impl.createDocument(None, 'policyDefinitionResources', 162 self._doc = dom_impl.createDocument(None, 'policyDefinitionResources',
163 None) 163 None)
164 if self._GetChromiumVersionString() is not None:
165 self.AddComment(self._doc.documentElement, self.config['build'] + \
166 ' version: ' + self._GetChromiumVersionString())
164 policy_definitions_resources_elem = self._doc.documentElement 167 policy_definitions_resources_elem = self._doc.documentElement
165 policy_definitions_resources_elem.attributes['revision'] = '1.0' 168 policy_definitions_resources_elem.attributes['revision'] = '1.0'
166 policy_definitions_resources_elem.attributes['schemaVersion'] = '1.0' 169 policy_definitions_resources_elem.attributes['schemaVersion'] = '1.0'
167 170
168 self.AddElement(policy_definitions_resources_elem, 'displayName') 171 self.AddElement(policy_definitions_resources_elem, 'displayName')
169 self.AddElement(policy_definitions_resources_elem, 'description') 172 self.AddElement(policy_definitions_resources_elem, 'description')
170 resources_elem = self.AddElement(policy_definitions_resources_elem, 173 resources_elem = self.AddElement(policy_definitions_resources_elem,
171 'resources') 174 'resources')
172 self._string_table_elem = self.AddElement(resources_elem, 'stringTable') 175 self._string_table_elem = self.AddElement(resources_elem, 'stringTable')
173 self._AddBaseStrings(self._string_table_elem, self.config['build']) 176 self._AddBaseStrings(self._string_table_elem, self.config['build'])
174 self._presentation_table_elem = self.AddElement(resources_elem, 177 self._presentation_table_elem = self.AddElement(resources_elem,
175 'presentationTable') 178 'presentationTable')
176 179
177 def GetTemplateText(self): 180 def GetTemplateText(self):
178 # Using "toprettyxml()" confuses the Windows Group Policy Editor 181 # Using "toprettyxml()" confuses the Windows Group Policy Editor
179 # (gpedit.msc) because it interprets whitespace characters in text between 182 # (gpedit.msc) because it interprets whitespace characters in text between
180 # the "string" tags. This prevents gpedit.msc from displaying the category 183 # the "string" tags. This prevents gpedit.msc from displaying the category
181 # names correctly. 184 # names correctly.
182 # TODO(markusheintz): Find a better formatting that works with gpedit. 185 # TODO(markusheintz): Find a better formatting that works with gpedit.
183 return self._doc.toxml() 186 return self._doc.toxml()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698