Page Speed Optimization Libraries
1.2.24.1
|
#include "static_javascript_manager.h"
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 GoogleString & | GetBlinkJsUrl (const RewriteOptions *options) const |
const GoogleString & | GetDeferJsUrl (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 [] |
Composes URLs for the javascript files injected by the various PSA filters.
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.
const GoogleString& net_instaweb::StaticJavascriptManager::GetBlinkJsUrl | ( | const RewriteOptions * | options | ) | const |
Returns the blink js url based on the value of debug filter and the value of serve_js_from_gstatic flag.
const GoogleString& net_instaweb::StaticJavascriptManager::GetDeferJsUrl | ( | const RewriteOptions * | options | ) | const |
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.