1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 """This module contains the Module class and other classes for resources.
6 The Module class represents a module in the trace viewer system. A module has
7 a name, and may require a variety of other resources, such as stylesheets,
8 template objects, raw javascript, or other modules.
10 Other resources include HTML templates, raw javascript files, and stylesheets.
15 from tvcm import style_sheet
18 class HTMLGenerationController(object):
20 self.current_module = None
22 def GetHTMLForStylesheetHRef(self, href):
25 def GetHTMLForInlineStylesheet(self, contents):
26 if self.current_module == None:
27 if re.search('url\(.+\)', contents):
28 raise Exception('Default HTMLGenerationController cannot handle inline style urls')
31 module_dirname = os.path.dirname(self.current_module.resource.absolute_path)
32 ss = style_sheet.ParsedStyleSheet(
33 self.current_module.loader, module_dirname, contents)
34 return ss.contents_with_inlined_images