Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / tools / grit / grit / format / policy_templates / writers / template_writer.py
index 935c886..d489d64 100644 (file)
@@ -87,6 +87,30 @@ class TemplateWriter(object):
     '''Checks if the given policy can be recommended.'''
     return policy.get('features', {}).get('can_be_recommended', False)
 
+  def CanBeMandatory(self, policy):
+    '''Checks if the given policy can be mandatory.'''
+    return policy.get('features', {}).get('can_be_mandatory', True)
+
+  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 _GetChromiumVersionString(self):
+    '''Returns the Chromium version string stored in the environment variable
+    version (if it is set).
+
+    Returns: The Chromium version string or None if it has not been set.'''
+
+    if 'version' in self.config:
+      return self.config['version']
+
   def _GetPoliciesForWriter(self, group):
     '''Filters the list of policies in the passed group that are supported by
     the writer.
@@ -176,6 +200,13 @@ class TemplateWriter(object):
     '''
     raise NotImplementedError()
 
+  def WriteComment(self, comment):
+    '''Appends the comment to the internal buffer.
+
+      comment: The comment to be added.
+    '''
+    raise NotImplementedError()
+
   def WriteRecommendedPolicy(self, policy):
     '''Appends the template text corresponding to a recommended policy into the
     internal buffer.