Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Attributes
net_instaweb::StaticJavascriptManager Class Reference

#include "static_javascript_manager.h"

List of all members.

Public Types

enum  JsModule {
  kAddInstrumentationJs, kClientDomainRewriter, kDeferIframe, kDeferJs,
  kDelayImagesJs, kDelayImagesInlineJs, kDeterministicJs, kLazyloadImagesJs,
  kDetectReflowJs, kLocalStorageCacheJs, kEndOfModules
}

Public Member Functions

 StaticJavascriptManager (UrlNamer *url_namer, Hasher *hasher, MessageHandler *message_handler)
const GoogleStringGetBlinkJsUrl (const RewriteOptions *options) const
const GoogleStringGetDeferJsUrl (const RewriteOptions *options) const
const char * GetJsSnippet (JsModule module, const RewriteOptions *options)
bool GetJsSnippet (StringPiece file_name, StringPiece *content, StringPiece *cache_header)
void AddJsToElement (StringPiece js, HtmlElement *script, RewriteDriver *driver)
void set_gstatic_blink_hash (const GoogleString &hash)
 Set the GStatic blink js hash.
void set_gstatic_defer_js_hash (const GoogleString &hash)
 Set the GStatic defer js hash.
void set_serve_js_from_gstatic (bool serve_js_from_gstatic)
 Set serve_js_from_gstatic_ to serve the files from gstatic.
void set_library_url_prefix (const StringPiece &url_prefix)
 Set the url prefix for outlining js.

Static Public Attributes

static const char kGStaticBase []
static const char kDefaultLibraryUrlPrefix []
static const char kBlinkGstaticSuffix []
static const char kDeferJsGstaticSuffix []
static const char kBlinkJsFileName []
static const char kDeferJsFileName []
static const char kDeferJsDebugFileName []
static const char kJsExtension []

Detailed Description

Composes URLs for the javascript files injected by the various PSA filters.

Todo:
TODO(ksimbili): Refactor out the common base class to serve the static files of type css, images or html etc.

Member Enumeration Documentation

Enumerator:
kEndOfModules 

Keep this as the last enum value.


Member Function Documentation

void net_instaweb::StaticJavascriptManager::AddJsToElement ( StringPiece  js,
HtmlElement script,
RewriteDriver driver 
)

Add a CharacterNode to an already created script element, properly escaping the text with CDATA tags is necessary. The script element should be added already, say with a call to InsertElementBeforeElement.

Returns the blink js url based on the value of debug filter and the value of serve_js_from_gstatic flag.

Returns the defer js url based on the value of debug filter and the value of serve_js_from_gstatic flag.

bool net_instaweb::StaticJavascriptManager::GetJsSnippet ( StringPiece  file_name,
StringPiece *  content,
StringPiece *  cache_header 
)

Get the Js snippet to be served as external file for the file names file_name. The snippet is returned as 'content' and cache-control headers is set into cache_header. If the hash matches, then ttl is set to 1 year, or else set to 'private max-age=300'. Returns true iff the content for filename is found.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines