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

Side by Side Diff: grit/format/policy_templates/writers/adm_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 6
7 from grit.format.policy_templates.writers import template_writer 7 from grit.format.policy_templates.writers import template_writer
8 8
9 9
10 NEWLINE = '\r\n' 10 NEWLINE = '\r\n'
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if policy['type'] == 'main': 145 if policy['type'] == 'main':
146 builder.AddLine('VALUENAME "%s"' % policy['name']) 146 builder.AddLine('VALUENAME "%s"' % policy['name'])
147 builder.AddLine('VALUEON NUMERIC 1') 147 builder.AddLine('VALUEON NUMERIC 1')
148 builder.AddLine('VALUEOFF NUMERIC 0') 148 builder.AddLine('VALUEOFF NUMERIC 0')
149 else: 149 else:
150 self._WritePart(policy, key_name, builder) 150 self._WritePart(policy, key_name, builder)
151 151
152 builder.AddLine('END POLICY', -1) 152 builder.AddLine('END POLICY', -1)
153 builder.AddLine() 153 builder.AddLine()
154 154
155 def WriteComment(self, comment):
156 self.lines.AddLine('; ' + comment)
157
155 def WritePolicy(self, policy): 158 def WritePolicy(self, policy):
156 if self.CanBeMandatory(policy): 159 if self.CanBeMandatory(policy):
157 self._WritePolicy(policy, 160 self._WritePolicy(policy,
158 self.config['win_reg_mandatory_key_name'], 161 self.config['win_reg_mandatory_key_name'],
159 self.policies) 162 self.policies)
160 163
161 def WriteRecommendedPolicy(self, policy): 164 def WriteRecommendedPolicy(self, policy):
162 self._WritePolicy(policy, 165 self._WritePolicy(policy,
163 self.config['win_reg_recommended_key_name'], 166 self.config['win_reg_recommended_key_name'],
164 self.recommended_policies) 167 self.recommended_policies)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 201
199 lines.AddLines(policies) 202 lines.AddLines(policies)
200 203
201 for part in category_path: 204 for part in category_path:
202 lines.AddLine('END CATEGORY', -1) 205 lines.AddLine('END CATEGORY', -1)
203 lines.AddLine() 206 lines.AddLine()
204 207
205 return lines 208 return lines
206 209
207 def BeginTemplate(self): 210 def BeginTemplate(self):
211 if self._GetChromiumVersionString() is not None:
212 self.WriteComment(self.config['build'] + ' version: ' + \
213 self._GetChromiumVersionString())
208 self._AddGuiString(self.config['win_supported_os'], 214 self._AddGuiString(self.config['win_supported_os'],
209 self.messages['win_supported_winxpsp2']['text']) 215 self.messages['win_supported_winxpsp2']['text'])
210 category_path = self.config['win_mandatory_category_path'] 216 category_path = self.config['win_mandatory_category_path']
211 recommended_category_path = self.config['win_recommended_category_path'] 217 recommended_category_path = self.config['win_recommended_category_path']
212 recommended_name = '%s - %s' % \ 218 recommended_name = '%s - %s' % \
213 (self.config['app_name'], self.messages['doc_recommended']['text']) 219 (self.config['app_name'], self.messages['doc_recommended']['text'])
214 if self.config['build'] == 'chrome': 220 if self.config['build'] == 'chrome':
215 self._AddGuiString(category_path[0], 'Google') 221 self._AddGuiString(category_path[0], 'Google')
216 self._AddGuiString(category_path[1], self.config['app_name']) 222 self._AddGuiString(category_path[1], self.config['app_name'])
217 self._AddGuiString(recommended_category_path[1], recommended_name) 223 self._AddGuiString(recommended_category_path[1], recommended_name)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 self.strings = IndentedStringBuilder() 255 self.strings = IndentedStringBuilder()
250 # Map of strings seen, to avoid duplicates. 256 # Map of strings seen, to avoid duplicates.
251 self.strings_seen = {} 257 self.strings_seen = {}
252 # String buffer for building the policies of the ADM file. 258 # String buffer for building the policies of the ADM file.
253 self.policies = IndentedStringBuilder() 259 self.policies = IndentedStringBuilder()
254 # String buffer for building the recommended policies of the ADM file. 260 # String buffer for building the recommended policies of the ADM file.
255 self.recommended_policies = IndentedStringBuilder() 261 self.recommended_policies = IndentedStringBuilder()
256 262
257 def GetTemplateText(self): 263 def GetTemplateText(self):
258 return self.lines.ToString() 264 return self.lines.ToString()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writer_configuration.py ('k') | grit/format/policy_templates/writers/adm_writer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698