| Index: components/policy/tools/generate_policy_source.py
|
| diff --git a/components/policy/tools/generate_policy_source.py b/components/policy/tools/generate_policy_source.py
|
| index e343e33785d4824bcc99b0afda691c0873a8b4cc..eda2e50ab245d322d88b16199c6be69203455017 100755
|
| --- a/components/policy/tools/generate_policy_source.py
|
| +++ b/components/policy/tools/generate_policy_source.py
|
| @@ -154,12 +154,6 @@ def main():
|
| help='generate an XML file as specified by '
|
| 'Android\'s App Restriction Schema',
|
| metavar='FILE')
|
| - parser.add_option('--arr', '--app-restrictions-resources',
|
| - dest='app_resources_path',
|
| - help='generate an XML file with resources supporting the '
|
| - 'restrictions defined in --app-restrictions-definition '
|
| - 'parameter',
|
| - metavar='FILE')
|
|
|
| (opts, args) = parser.parse_args()
|
|
|
| @@ -191,7 +185,6 @@ def main():
|
|
|
| if os == 'android':
|
| GenerateFile(opts.app_restrictions_path, _WriteAppRestrictions, xml=True)
|
| - GenerateFile(opts.app_resources_path, _WriteResourcesForPolicies, xml=True)
|
|
|
| return 0
|
|
|
| @@ -1007,14 +1000,6 @@ def _WriteCloudPolicyDecoder(policies, os, f):
|
| f.write(CPP_FOOT)
|
|
|
|
|
| -def _EscapeResourceString(raw_resource):
|
| - if type(raw_resource) == int:
|
| - return raw_resource
|
| - return xml_escape(raw_resource)\
|
| - .replace('\\', '\\\\')\
|
| - .replace('\"','\\\"')\
|
| - .replace('\'','\\\'')
|
| -
|
| def _WriteAppRestrictions(policies, os, f):
|
|
|
| def WriteRestrictionCommon(key):
|
| @@ -1045,44 +1030,5 @@ def _WriteAppRestrictions(policies, os, f):
|
| WriteAppRestriction(policy)
|
| f.write('</restrictions>')
|
|
|
| -
|
| -def _WriteResourcesForPolicies(policies, os, f):
|
| -
|
| - # TODO(knn): Update this to support i18n.
|
| - def WriteString(key, value):
|
| - f.write(' <string name="%s">%s</string>\n'
|
| - % (key, _EscapeResourceString(value)))
|
| -
|
| - def WriteItems(key, items):
|
| - if items:
|
| - f.write(' <string-array name="%sEntries">\n' % key)
|
| - for item in items:
|
| - f.write(' <item>%s</item>\n' %
|
| - _EscapeResourceString(item.caption))
|
| - f.write(' </string-array>\n')
|
| - f.write(' <string-array name="%sValues">\n' % key)
|
| - for item in items:
|
| - f.write(' <item>%s</item>\n' % _EscapeResourceString(item.value))
|
| - f.write(' </string-array>\n')
|
| -
|
| - def WriteResourceForPolicy(policy):
|
| - policy_name = policy.name
|
| - WriteString(policy_name + 'Title', policy.caption)
|
| -
|
| - # Get the first line of the policy description.
|
| - description = policy.desc.split('\n', 1)[0]
|
| - WriteString(policy_name + 'Desc', description)
|
| -
|
| - if policy.has_restriction_resources:
|
| - WriteItems(policy_name, policy.items)
|
| -
|
| - # _WriteResourcesForPolicies body
|
| - f.write('<resources>\n\n')
|
| - for policy in policies:
|
| - if policy.is_supported and policy.restriction_type != 'invalid':
|
| - WriteResourceForPolicy(policy)
|
| - f.write('</resources>')
|
| -
|
| -
|
| if __name__ == '__main__':
|
| sys.exit(main())
|
|
|