| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |