19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_STATIC_ASSET_MANAGER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_STATIC_ASSET_MANAGER_H_
25 #include "pagespeed/kernel/base/basictypes.h"
26 #include "pagespeed/kernel/base/string.h"
27 #include "pagespeed/kernel/base/string_util.h"
29 namespace net_instaweb {
46 static const char kGStaticBase[];
47 static const char kDefaultLibraryUrlPrefix[];
50 kAddInstrumentationJs,
53 kClientDomainRewriter,
56 kCriticalImagesBeaconJs,
57 kDedupInlinedImagesJs,
63 kExtendedInstrumentationJs,
73 MessageHandler* message_handler);
91 bool GetAsset(StringPiece file_name, StringPiece* content,
92 ContentType* content_type, StringPiece* cache_header)
const;
104 const GoogleString& gstatic_base,
105 const GoogleString& hash);
113 serve_asset_from_gstatic_ = serve_asset_from_gstatic;
118 url_prefix.CopyToString(&library_url_prefix_);
119 InitializeAssetUrls();
122 void set_static_asset_base(
const StringPiece& x) {
123 x.CopyToString(&static_asset_base_);
124 InitializeAssetUrls();
130 typedef std::map<GoogleString, StaticAsset> FileNameToModuleMap;
132 void InitializeAssetStrings();
133 void InitializeAssetUrls();
135 GoogleString static_asset_base_;
138 MessageHandler* message_handler_;
140 std::vector<Asset*> assets_;
141 FileNameToModuleMap file_name_to_module_map_;
143 bool serve_asset_from_gstatic_;
144 GoogleString library_url_prefix_;
145 GoogleString cache_header_with_long_ttl_;
146 GoogleString cache_header_with_private_ttl_;
148 DISALLOW_COPY_AND_ASSIGN(StaticAssetManager);
void set_serve_asset_from_gstatic(bool serve_asset_from_gstatic)
Definition: static_asset_manager.h:112
const char * GetAsset(const StaticAsset &module, const RewriteOptions *options) const
Returns the contents of the asset.
void AddJsToElement(StringPiece js, HtmlElement *script, RewriteDriver *driver) const
Definition: static_asset_manager.h:44
const GoogleString & GetAssetUrl(const StaticAsset &module, const RewriteOptions *options) const
void set_gstatic_hash(const StaticAsset &module, const GoogleString &gstatic_base, const GoogleString &hash)
void set_library_url_prefix(const StringPiece &url_prefix)
Set the prefix for the URLs of assets.
Definition: static_asset_manager.h:117
Definition: rewrite_driver.h:98
StaticAsset
Definition: static_asset_manager.h:49
Definition: rewrite_options.h:83
Keep this as the last enum value.
Definition: static_asset_manager.h:68