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

Unified Diff: components/policy/tools/generate_policy_source.py

Issue 546703004: Add mandatory policy setting for template generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and removed setting for SessionLocale Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/policy/resources/policy_templates.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85d0f51aaafcb279d9edca3f943ad70d1e357889..c3096c74928007307bce487fd07e907939153616 100755
--- a/components/policy/tools/generate_policy_source.py
+++ b/components/policy/tools/generate_policy_source.py
@@ -54,6 +54,9 @@ class PolicyDetails:
def __init__(self, policy, os, is_chromium_os):
self.id = policy['id']
self.name = policy['name']
+ features = policy.get('features', {})
+ self.can_be_recommended = features.get('can_be_recommended', False)
+ self.can_be_mandatory = features.get('can_be_mandatory', True)
self.is_deprecated = policy.get('deprecated', False)
self.is_device_only = policy.get('device_only', False)
self.schema = policy.get('schema', {})
@@ -785,6 +788,9 @@ def _WritePolicyProto(f, policy, fields):
json.dumps(policy.schema, sort_keys=True, indent=4,
separators=(',', ': ')))
_OutputComment(f, '\nSupported on: %s' % ', '.join(policy.platforms))
+ if policy.can_be_recommended and not policy.can_be_mandatory:
+ _OutputComment(f, '\nNote: this policy must have a RECOMMENDED ' +\
+ 'PolicyMode set in PolicyOptions.')
f.write('message %sProto {\n' % policy.name)
f.write(' optional PolicyOptions policy_options = 1;\n')
f.write(' optional %s %s = 2;\n' % (policy.protobuf_type, policy.name))
« no previous file with comments | « components/policy/resources/policy_templates.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698