1 #!/usr/bin/env python 2 3 # Copyright 2014 The Chromium Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 7 import media_feature_symbol 8 import in_generator 9 import template_expander 10 import name_utilities 11 import sys 12 13 14 class MakeMediaFeaturesWriter(in_generator.Writer): 15 defaults = { 16 'Conditional': None, # FIXME: Add support for Conditional. 17 'RuntimeEnabled': None, 18 'ImplementedAs': None, 19 } 20 filters = { 21 'symbol': media_feature_symbol.getMediaFeatureSymbolWithSuffix(''), 22 'to_macro_style': name_utilities.to_macro_style, 23 } 24 default_parameters = { 25 'namespace': '', 26 'export': '', 27 } 28 29 def __init__(self, in_file_path): 30 super(MakeMediaFeaturesWriter, self).__init__(in_file_path) 31 32 self._outputs = { 33 ('MediaFeatures.h'): self.generate_header, 34 } 35 self._template_context = { 36 'namespace': '', 37 'export': '', 38 'entries': self.in_file.name_dictionaries, 39 } 40 41 @template_expander.use_jinja('MediaFeatures.h.tmpl', filters=filters) 42 def generate_header(self): 43 return self._template_context 44 45 if __name__ == '__main__': 46 in_generator.Maker(MakeMediaFeaturesWriter).main(sys.argv) 47