| 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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 elif policy_type == 'int': | 92 elif policy_type == 'int': |
| 93 textbox_elem = self.AddElement(presentation_elem, 'decimalTextBox', | 93 textbox_elem = self.AddElement(presentation_elem, 'decimalTextBox', |
| 94 {'refId': policy_name}) | 94 {'refId': policy_name}) |
| 95 textbox_elem.appendChild(self._doc.createTextNode(policy_label + ':')) | 95 textbox_elem.appendChild(self._doc.createTextNode(policy_label + ':')) |
| 96 elif policy_type in ('int-enum', 'string-enum'): | 96 elif policy_type in ('int-enum', 'string-enum'): |
| 97 for item in policy['items']: | 97 for item in policy['items']: |
| 98 self._AddString(self._string_table_elem, item['name'], item['caption']) | 98 self._AddString(self._string_table_elem, item['name'], item['caption']) |
| 99 dropdownlist_elem = self.AddElement(presentation_elem, 'dropdownList', | 99 dropdownlist_elem = self.AddElement(presentation_elem, 'dropdownList', |
| 100 {'refId': policy_name}) | 100 {'refId': policy_name}) |
| 101 dropdownlist_elem.appendChild(self._doc.createTextNode(policy_label)) | 101 dropdownlist_elem.appendChild(self._doc.createTextNode(policy_label)) |
| 102 elif policy_type == 'list': | 102 elif policy_type in ('list', 'string-enum-list'): |
| 103 self._AddString(self._string_table_elem, | 103 self._AddString(self._string_table_elem, |
| 104 policy_name + 'Desc', | 104 policy_name + 'Desc', |
| 105 policy_caption) | 105 policy_caption) |
| 106 listbox_elem = self.AddElement(presentation_elem, 'listBox', | 106 listbox_elem = self.AddElement(presentation_elem, 'listBox', |
| 107 {'refId': policy_name + 'Desc'}) | 107 {'refId': policy_name + 'Desc'}) |
| 108 listbox_elem.appendChild(self._doc.createTextNode(policy_label)) | 108 listbox_elem.appendChild(self._doc.createTextNode(policy_label)) |
| 109 elif policy_type == 'group': | 109 elif policy_type == 'group': |
| 110 pass | 110 pass |
| 111 elif policy_type == 'external': | 111 elif policy_type == 'external': |
| 112 # This type can only be set through cloud policy. | 112 # This type can only be set through cloud policy. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 self._presentation_table_elem = self.AddElement(resources_elem, | 174 self._presentation_table_elem = self.AddElement(resources_elem, |
| 175 'presentationTable') | 175 'presentationTable') |
| 176 | 176 |
| 177 def GetTemplateText(self): | 177 def GetTemplateText(self): |
| 178 # Using "toprettyxml()" confuses the Windows Group Policy Editor | 178 # Using "toprettyxml()" confuses the Windows Group Policy Editor |
| 179 # (gpedit.msc) because it interprets whitespace characters in text between | 179 # (gpedit.msc) because it interprets whitespace characters in text between |
| 180 # the "string" tags. This prevents gpedit.msc from displaying the category | 180 # the "string" tags. This prevents gpedit.msc from displaying the category |
| 181 # names correctly. | 181 # names correctly. |
| 182 # TODO(markusheintz): Find a better formatting that works with gpedit. | 182 # TODO(markusheintz): Find a better formatting that works with gpedit. |
| 183 return self._doc.toxml() | 183 return self._doc.toxml() |
| OLD | NEW |