Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: grit/format/policy_templates/writers/plist_writer.py

Issue 92213002: Add support for Chrome policy type that references external data (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 xml.dom import minidom 7 from xml.dom import minidom
8 from grit.format.policy_templates.writers import plist_helper 8 from grit.format.policy_templates.writers import plist_helper
9 from grit.format.policy_templates.writers import xml_formatted_writer 9 from grit.format.policy_templates.writers import xml_formatted_writer
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 ''' 74 '''
75 array = self._AddKeyValuePair(parent, 'pfm_targets', 'array') 75 array = self._AddKeyValuePair(parent, 'pfm_targets', 'array')
76 self.AddElement(array, 'string', {}, 'user-managed') 76 self.AddElement(array, 'string', {}, 'user-managed')
77 77
78 def PreprocessPolicies(self, policy_list): 78 def PreprocessPolicies(self, policy_list):
79 return self.FlattenGroupsAndSortPolicies(policy_list) 79 return self.FlattenGroupsAndSortPolicies(policy_list)
80 80
81 def WritePolicy(self, policy): 81 def WritePolicy(self, policy):
82 policy_name = policy['name'] 82 policy_name = policy['name']
83 policy_type = policy['type'] 83 policy_type = policy['type']
84 if policy_type == 'external':
85 # This type can only be set through cloud policy.
86 return
84 87
85 dict = self.AddElement(self._array, 'dict') 88 dict = self.AddElement(self._array, 'dict')
86 self._AddStringKeyValuePair(dict, 'pfm_name', policy_name) 89 self._AddStringKeyValuePair(dict, 'pfm_name', policy_name)
87 # Set empty strings for title and description. They will be taken by the 90 # Set empty strings for title and description. They will be taken by the
88 # OSX Workgroup Manager from the string table in a Localizable.strings file. 91 # OSX Workgroup Manager from the string table in a Localizable.strings file.
89 # Those files are generated by plist_strings_writer. 92 # Those files are generated by plist_strings_writer.
90 self._AddStringKeyValuePair(dict, 'pfm_description', '') 93 self._AddStringKeyValuePair(dict, 'pfm_description', '')
91 self._AddStringKeyValuePair(dict, 'pfm_title', '') 94 self._AddStringKeyValuePair(dict, 'pfm_title', '')
92 self._AddTargets(dict) 95 self._AddTargets(dict)
93 self._AddStringKeyValuePair(dict, 'pfm_type', 96 self._AddStringKeyValuePair(dict, 'pfm_type',
(...skipping 25 matching lines...) Expand all
119 dom_impl = minidom.getDOMImplementation('') 122 dom_impl = minidom.getDOMImplementation('')
120 doctype = dom_impl.createDocumentType( 123 doctype = dom_impl.createDocumentType(
121 'plist', 124 'plist',
122 '-//Apple//DTD PLIST 1.0//EN', 125 '-//Apple//DTD PLIST 1.0//EN',
123 'http://www.apple.com/DTDs/PropertyList-1.0.dtd') 126 'http://www.apple.com/DTDs/PropertyList-1.0.dtd')
124 self._doc = dom_impl.createDocument(None, 'plist', doctype) 127 self._doc = dom_impl.createDocument(None, 'plist', doctype)
125 self._plist = self._doc.documentElement 128 self._plist = self._doc.documentElement
126 129
127 def GetTemplateText(self): 130 def GetTemplateText(self):
128 return self.ToPrettyXml(self._doc) 131 return self.ToPrettyXml(self._doc)
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/plist_strings_writer.py ('k') | grit/format/policy_templates/writers/reg_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698