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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 == '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': |
| 112 # This type can only be set through cloud policy. |
| 113 pass |
111 else: | 114 else: |
112 raise Exception('Unknown policy type %s.' % policy_type) | 115 raise Exception('Unknown policy type %s.' % policy_type) |
113 | 116 |
114 def BeginPolicyGroup(self, group): | 117 def BeginPolicyGroup(self, group): |
115 '''Generates ADML elements for a Policy-Group. For each Policy-Group two | 118 '''Generates ADML elements for a Policy-Group. For each Policy-Group two |
116 ADML "string" elements are added to the string-table. One contains the | 119 ADML "string" elements are added to the string-table. One contains the |
117 caption of the Policy-Group and the other a description. A Policy-Group also | 120 caption of the Policy-Group and the other a description. A Policy-Group also |
118 requires an ADML "presentation" element that must be added to the | 121 requires an ADML "presentation" element that must be added to the |
119 presentation-table. The "presentation" element is the container for the | 122 presentation-table. The "presentation" element is the container for the |
120 elements that define the visual presentation of the Policy-Goup's Policies. | 123 elements that define the visual presentation of the Policy-Goup's Policies. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 self._presentation_table_elem = self.AddElement(resources_elem, | 174 self._presentation_table_elem = self.AddElement(resources_elem, |
172 'presentationTable') | 175 'presentationTable') |
173 | 176 |
174 def GetTemplateText(self): | 177 def GetTemplateText(self): |
175 # Using "toprettyxml()" confuses the Windows Group Policy Editor | 178 # Using "toprettyxml()" confuses the Windows Group Policy Editor |
176 # (gpedit.msc) because it interprets whitespace characters in text between | 179 # (gpedit.msc) because it interprets whitespace characters in text between |
177 # the "string" tags. This prevents gpedit.msc from displaying the category | 180 # the "string" tags. This prevents gpedit.msc from displaying the category |
178 # names correctly. | 181 # names correctly. |
179 # TODO(markusheintz): Find a better formatting that works with gpedit. | 182 # TODO(markusheintz): Find a better formatting that works with gpedit. |
180 return self._doc.toxml() | 183 return self._doc.toxml() |
OLD | NEW |