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

Unified Diff: grit/format/policy_templates/writers/template_writer.py

Issue 91273002: Improve platform support indications for policy documentation. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 7 years, 1 month 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
Index: grit/format/policy_templates/writers/template_writer.py
diff --git a/grit/format/policy_templates/writers/template_writer.py b/grit/format/policy_templates/writers/template_writer.py
index 935c886aec2c3d482a6e5184fd1691b1c4008b62..2a8b548b193bb84e552e3c326a55917d48c5adc6 100644
--- a/grit/format/policy_templates/writers/template_writer.py
+++ b/grit/format/policy_templates/writers/template_writer.py
@@ -87,6 +87,17 @@ class TemplateWriter(object):
'''Checks if the given policy can be recommended.'''
return policy.get('features', {}).get('can_be_recommended', False)
+ def IsPolicySupportedOnPlatform(self, policy, platform):
+ '''Checks if |policy| is supported on |platform|.
+
+ Args:
+ policy: The dictionary of the policy.
+ platform: The platform to check; one of 'win', 'mac', 'linux' or
+ 'chrome_os'.
+ '''
+ is_supported = lambda x: platform in x['platforms']
+ return any(filter(is_supported, policy['supported_on']))
+
def _GetPoliciesForWriter(self, group):
'''Filters the list of policies in the passed group that are supported by
the writer.

Powered by Google App Engine
This is Rietveld 408576698