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

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

Issue 92213002: Add support for Chrome policy type that references external data (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | grit/format/policy_templates/writers/adml_writer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 value_text = 'NUMERIC ' + str(item['value']) 123 value_text = 'NUMERIC ' + str(item['value'])
124 else: 124 else:
125 value_text = '"' + item['value'] + '"' 125 value_text = '"' + item['value'] + '"'
126 builder.AddLine('NAME !!%s_DropDown VALUE %s' % 126 builder.AddLine('NAME !!%s_DropDown VALUE %s' %
127 (item['name'], value_text)) 127 (item['name'], value_text))
128 self._AddGuiString(item['name'] + '_DropDown', item['caption']) 128 self._AddGuiString(item['name'] + '_DropDown', item['caption'])
129 builder.AddLine('END ITEMLIST', -1) 129 builder.AddLine('END ITEMLIST', -1)
130 builder.AddLine('END PART', -1) 130 builder.AddLine('END PART', -1)
131 131
132 def _WritePolicy(self, policy, key_name, builder): 132 def _WritePolicy(self, policy, key_name, builder):
133 if policy['type'] == 'external':
134 # This type can only be set through cloud policy.
135 return
136
133 self._AddGuiString(policy['name'] + '_Policy', policy['caption']) 137 self._AddGuiString(policy['name'] + '_Policy', policy['caption'])
134 builder.AddLine('POLICY !!%s_Policy' % policy['name'], 1) 138 builder.AddLine('POLICY !!%s_Policy' % policy['name'], 1)
135 self._WriteSupported(builder) 139 self._WriteSupported(builder)
136 policy_explain_name = policy['name'] + '_Explain' 140 policy_explain_name = policy['name'] + '_Explain'
137 self._AddGuiString(policy_explain_name, policy['desc']) 141 self._AddGuiString(policy_explain_name, policy['desc'])
138 builder.AddLine('EXPLAIN !!' + policy_explain_name) 142 builder.AddLine('EXPLAIN !!' + policy_explain_name)
139 143
140 if policy['type'] == 'main': 144 if policy['type'] == 'main':
141 builder.AddLine('VALUENAME "%s"' % policy['name']) 145 builder.AddLine('VALUENAME "%s"' % policy['name'])
142 builder.AddLine('VALUEON NUMERIC 1') 146 builder.AddLine('VALUEON NUMERIC 1')
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 self.strings = IndentedStringBuilder() 247 self.strings = IndentedStringBuilder()
244 # Map of strings seen, to avoid duplicates. 248 # Map of strings seen, to avoid duplicates.
245 self.strings_seen = {} 249 self.strings_seen = {}
246 # String buffer for building the policies of the ADM file. 250 # String buffer for building the policies of the ADM file.
247 self.policies = IndentedStringBuilder() 251 self.policies = IndentedStringBuilder()
248 # String buffer for building the recommended policies of the ADM file. 252 # String buffer for building the recommended policies of the ADM file.
249 self.recommended_policies = IndentedStringBuilder() 253 self.recommended_policies = IndentedStringBuilder()
250 254
251 def GetTemplateText(self): 255 def GetTemplateText(self):
252 return self.lines.ToString() 256 return self.lines.ToString()
OLDNEW
« no previous file with comments | « no previous file | grit/format/policy_templates/writers/adml_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698