Chromium Code Reviews

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

Issue 4704006: Add version information to the policy templates (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix typo in merge Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/format/policy_templates/writers/template_writer.py
diff --git a/tools/grit/grit/format/policy_templates/writers/template_writer.py b/tools/grit/grit/format/policy_templates/writers/template_writer.py
index aa4f2335410ec1cf65f3a48d9d1462ba66e9fe08..8b742d56a686f33b4917301380357a0330391533 100644
--- a/tools/grit/grit/format/policy_templates/writers/template_writer.py
+++ b/tools/grit/grit/format/policy_templates/writers/template_writer.py
@@ -3,6 +3,9 @@
# found in the LICENSE file.
+import itertools
+
+
class TemplateWriter(object):
'''Abstract base class for writing policy templates in various formats.
The methods of this class will be called by PolicyTemplateGenerator.
@@ -32,6 +35,9 @@ class TemplateWriter(object):
def IsPolicySupported(self, policy):
'''Checks if the given policy is supported by the writer.
+ In other words, the set of platforms supported by the writer
+ has a common subset with the set of platforms that support
+ the policy.
Args:
policy: The dictionary of the policy.
@@ -39,9 +45,13 @@ class TemplateWriter(object):
Returns:
True if the writer chooses to include 'policy' in its output.
'''
- for platform in self.platforms:
- if platform in policy['annotations']['platforms']:
- return True
+ if '*' in self.platforms:
+ # Currently chrome_os is only catched here.
+ return True
+ for supported_on in policy['supported_on']:
+ for supported_on_platform in supported_on['platforms']:
+ if supported_on_platform in self.platforms:
+ return True
return False
def _GetPoliciesForWriter(self, group):
« no previous file with comments | « tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine