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

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

Issue 1372953002: Add support for the 'webview_android' policy configuration (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Remove OWNERS file Created 5 years, 2 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 | « grit/format/policy_templates/writers/doc_writer_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d489d648c3767e9a1d94e57e851745abf52b4d76..4a23ff5a606553e08c46468f384b8df28da17fe4 100644
--- a/grit/format/policy_templates/writers/template_writer.py
+++ b/grit/format/policy_templates/writers/template_writer.py
@@ -91,7 +91,7 @@ class TemplateWriter(object):
'''Checks if the given policy can be mandatory.'''
return policy.get('features', {}).get('can_be_mandatory', True)
- def IsPolicySupportedOnPlatform(self, policy, platform):
+ def IsPolicySupportedOnPlatform(self, policy, platform, product=None):
'''Checks if |policy| is supported on |platform|.
Args:
@@ -99,7 +99,14 @@ class TemplateWriter(object):
platform: The platform to check; one of 'win', 'mac', 'linux' or
'chrome_os'.
'''
- is_supported = lambda x: platform in x['platforms']
Nico 2015/11/02 16:41:10 This returns a bool…
+
+ def is_supported(supported_on):
+ if not platform in supported_on['platforms']:
Nico 2015/11/02 16:41:10 nit: `platform not in` instead of `not platform in
dgn 2015/11/02 18:19:50 Acknowledged.
+ return None
+ if product and not product in supported_on['product']:
Nico 2015/11/02 16:41:10 same nit
dgn 2015/11/02 18:19:50 Acknowledged.
+ return None
+ return supported_on
Nico 2015/11/02 16:41:10 …but this returns an object. Since it's used with
dgn 2015/11/02 18:19:50 Done.
+
return any(filter(is_supported, policy['supported_on']))
def _GetChromiumVersionString(self):
« no previous file with comments | « grit/format/policy_templates/writers/doc_writer_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698