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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 raise Exception('There is supposed to be only one "elements" node but' | 246 raise Exception('There is supposed to be only one "elements" node but' |
247 ' there are %s.' % str(len(elements_list))) | 247 ' there are %s.' % str(len(elements_list))) |
248 | 248 |
249 def _WritePolicy(self, policy, name, key, parent): | 249 def _WritePolicy(self, policy, name, key, parent): |
250 '''Generates AMDX elements for a Policy. There are four different policy | 250 '''Generates AMDX elements for a Policy. There are four different policy |
251 types: Main-Policy, String-Policy, Enum-Policy and List-Policy. | 251 types: Main-Policy, String-Policy, Enum-Policy and List-Policy. |
252 ''' | 252 ''' |
253 policies_elem = self._active_policies_elem | 253 policies_elem = self._active_policies_elem |
254 policy_type = policy['type'] | 254 policy_type = policy['type'] |
255 policy_name = policy['name'] | 255 policy_name = policy['name'] |
| 256 if policy_type == 'external': |
| 257 # This type can only be set through cloud policy. |
| 258 return |
256 | 259 |
257 attributes = { | 260 attributes = { |
258 'name': name, | 261 'name': name, |
259 'class': self.config['win_group_policy_class'], | 262 'class': self.config['win_group_policy_class'], |
260 'displayName': self._AdmlString(policy_name), | 263 'displayName': self._AdmlString(policy_name), |
261 'explainText': self._AdmlStringExplain(policy_name), | 264 'explainText': self._AdmlStringExplain(policy_name), |
262 'presentation': self._AdmlPresentation(policy_name), | 265 'presentation': self._AdmlPresentation(policy_name), |
263 'key': key, | 266 'key': key, |
264 } | 267 } |
265 # Store the current "policy" AMDX element in self for later use by the | 268 # Store the current "policy" AMDX element in self for later use by the |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 self._AddCategories(self.config['win_recommended_category_path']) | 366 self._AddCategories(self.config['win_recommended_category_path']) |
364 self._active_policies_elem = self.AddElement(policy_definitions_elem, | 367 self._active_policies_elem = self.AddElement(policy_definitions_elem, |
365 'policies') | 368 'policies') |
366 self._active_mandatory_policy_group_name = \ | 369 self._active_mandatory_policy_group_name = \ |
367 self.config['win_mandatory_category_path'][-1] | 370 self.config['win_mandatory_category_path'][-1] |
368 self._active_recommended_policy_group_name = \ | 371 self._active_recommended_policy_group_name = \ |
369 self.config['win_recommended_category_path'][-1] | 372 self.config['win_recommended_category_path'][-1] |
370 | 373 |
371 def GetTemplateText(self): | 374 def GetTemplateText(self): |
372 return self.ToPrettyXml(self._doc) | 375 return self.ToPrettyXml(self._doc) |
OLD | NEW |