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

#include "css_url_encoder.h"

Inheritance diagram for net_instaweb::CssUrlEncoder:

Public Member Functions

virtual void Encode (const StringVector &urls, const ResourceContext *encoding, GoogleString *rewritten_url) const
virtual bool Decode (const StringPiece &url_segment, StringVector *urls, ResourceContext *dim, MessageHandler *handler) const

Static Public Member Functions

static void SetInliningImages (const RequestProperties &request_properties, ResourceContext *resource_context)
 Sets Inlining of image according to the user agent.

Detailed Description

This class implements the encoding of css urls with optional additional dimension metadata. For the legacy encoding, it used to prepend characters indicating whether the user-agent allows for inlining or webp. We may need to employ distinct CSS files for these types of browsers. This information is conveyed in the ResourceContext. http://..path../W.cssfile... CSS file optimized for webp-capable browsers. http://..path../I.cssfile... CSS file optimzed for for non-webp browsers that inline. http://..path../A.cssfile... Archaic browser (ie6+7) does neither.

Note that a legacy CSS URL beginning with W., I., or A. will be misinterpreted and will not be fetchable since the Decode function will strip off the leading 2 characters.

Note that a lot of this is legacy encoding now, and that we just unconditionally use the "A." encoding and rely on content hash and metadata cache + user-agent sniffing to keep things consistent.

Member Function Documentation

virtual bool net_instaweb::CssUrlEncoder::Decode ( const StringPiece &  url_segment,
StringVector *  urls,
ResourceContext *  out_data,
MessageHandler handler 
) const

Decode URLs from "url_segment". Note that there may be other meta-data encoded in url_segment, which this function will write into out_data, if present.

Reimplemented from net_instaweb::UrlSegmentEncoder.

virtual void net_instaweb::CssUrlEncoder::Encode ( const StringVector &  urls,
const ResourceContext *  data,
GoogleString url_segment 
) const

Encodes arbitrary text so it can be used in a url segment. A url segment must contain only characters that are legal in URLs, and exclude "/" and "." which are used for a higher level encoding scheme into which this must fit.

'data' is optional – it can be NULL and it is up to the encoder to decide what to do.

Reimplemented from net_instaweb::UrlSegmentEncoder.

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