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 | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 WritePolicy(self, policy): | 155 def WritePolicy(self, policy): |
156 self._WritePolicy(policy, | 156 if self.CanBeMandatory(policy): |
157 self.config['win_reg_mandatory_key_name'], | 157 self._WritePolicy(policy, |
158 self.policies) | 158 self.config['win_reg_mandatory_key_name'], |
| 159 self.policies) |
159 | 160 |
160 def WriteRecommendedPolicy(self, policy): | 161 def WriteRecommendedPolicy(self, policy): |
161 self._WritePolicy(policy, | 162 self._WritePolicy(policy, |
162 self.config['win_reg_recommended_key_name'], | 163 self.config['win_reg_recommended_key_name'], |
163 self.recommended_policies) | 164 self.recommended_policies) |
164 | 165 |
165 def BeginPolicyGroup(self, group): | 166 def BeginPolicyGroup(self, group): |
166 category_name = group['name'] + '_Category' | 167 category_name = group['name'] + '_Category' |
167 self._AddGuiString(category_name, group['caption']) | 168 self._AddGuiString(category_name, group['caption']) |
168 self.policies.AddLine('CATEGORY !!' + category_name, 1) | 169 self.policies.AddLine('CATEGORY !!' + category_name, 1) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 self.strings = IndentedStringBuilder() | 249 self.strings = IndentedStringBuilder() |
249 # Map of strings seen, to avoid duplicates. | 250 # Map of strings seen, to avoid duplicates. |
250 self.strings_seen = {} | 251 self.strings_seen = {} |
251 # String buffer for building the policies of the ADM file. | 252 # String buffer for building the policies of the ADM file. |
252 self.policies = IndentedStringBuilder() | 253 self.policies = IndentedStringBuilder() |
253 # String buffer for building the recommended policies of the ADM file. | 254 # String buffer for building the recommended policies of the ADM file. |
254 self.recommended_policies = IndentedStringBuilder() | 255 self.recommended_policies = IndentedStringBuilder() |
255 | 256 |
256 def GetTemplateText(self): | 257 def GetTemplateText(self): |
257 return self.lines.ToString() | 258 return self.lines.ToString() |
OLD | NEW |