summaryrefslogtreecommitdiffstats
path: root/chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py')
-rw-r--r--chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py b/chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py
index 25a8c0bbdc7..22978581ea4 100644
--- a/chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py
+++ b/chromium/tools/grit/grit/format/policy_templates/writers/plist_writer.py
@@ -9,6 +9,10 @@ from grit.format.policy_templates.writers import plist_helper
from grit.format.policy_templates.writers import xml_formatted_writer
+# This writer outputs a Preferences Manifest file as documented at
+# https://developer.apple.com/library/mac/documentation/MacOSXServer/Conceptual/Preference_Manifest_Files
+
+
def GetWriter(config):
'''Factory method for creating PListWriter objects.
See the constructor of TemplateWriter for description of
@@ -103,6 +107,11 @@ class PListWriter(xml_formatted_writer.XMLFormattedWriter):
else:
element_type = 'string'
self.AddElement(range_list, element_type, {}, str(item['value']))
+ elif policy_type == 'list':
+ subkeys = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array')
+ subkeys_dict = self.AddElement(subkeys, 'dict')
+ subkeys_type = self._AddKeyValuePair(subkeys_dict, 'pfm_type', 'string')
+ self.AddText(subkeys_type, 'string')
def BeginTemplate(self):
self._plist.attributes['version'] = '1'
@@ -118,13 +127,16 @@ class PListWriter(xml_formatted_writer.XMLFormattedWriter):
self._array = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array')
- def Init(self):
+ def CreatePlistDocument(self):
dom_impl = minidom.getDOMImplementation('')
doctype = dom_impl.createDocumentType(
'plist',
'-//Apple//DTD PLIST 1.0//EN',
'http://www.apple.com/DTDs/PropertyList-1.0.dtd')
- self._doc = dom_impl.createDocument(None, 'plist', doctype)
+ return dom_impl.createDocument(None, 'plist', doctype)
+
+ def Init(self):
+ self._doc = self.CreatePlistDocument()
self._plist = self._doc.documentElement
def GetTemplateText(self):