Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::AssociationTransformer Class Reference

#include "association_transformer.h"

Inheritance diagram for net_instaweb::AssociationTransformer:
net_instaweb::CssTagScanner::Transformer

Public Member Functions

 AssociationTransformer (const GoogleUrl *base_url, const RewriteOptions *options, CssTagScanner::Transformer *backup_transformer, MessageHandler *handler)
 
StringStringMap * map ()
 
virtual TransformStatus Transform (GoogleString *str)
 

Additional Inherited Members

- Public Types inherited from net_instaweb::CssTagScanner::Transformer
enum  TransformStatus { kSuccess, kNoChange, kFailure }
 

Detailed Description

Transformer that uses a std::map to specify which URLs to rewrite to which other URLs. Used by CssFilter to rewrite subresources in CSS even when it cannot be parsed, by using AssociationSlots to update the map before transforming.

Constructor & Destructor Documentation

net_instaweb::AssociationTransformer::AssociationTransformer ( const GoogleUrl base_url,
const RewriteOptions options,
CssTagScanner::Transformer backup_transformer,
MessageHandler handler 
)
inline

base_url is the URL all CSS url()s should be absolutified against, this is generally the URL for the CSS file or HTML file for inline CSS. backup_transformer is another transformer to be applied if no association has been set in AssociationTransformer's map_. It may be set to NULL if no backup is needed.

base_url, options, backup_transformer and handler must live longer than AssociationTransformer.

Member Function Documentation

StringStringMap* net_instaweb::AssociationTransformer::map ( )
inline

Map is exposed so that you can set associations. Each key -> value specifies that every instance of the absolute URL key should be transformed to the absolute URL value.

virtual TransformStatus net_instaweb::AssociationTransformer::Transform ( GoogleString str)
virtual

To do the actual transformation. Call CssTagScanner::TransformUrls() with this AssociationTransformer which will call Transform() on all URLs. Transform will lookup all (absolutified) URLs in map_ and rewrite them if present (otherwise it will pass them to the backup_transformer_).

Implements net_instaweb::CssTagScanner::Transformer.


The documentation for this class was generated from the following file: