18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_URL_ENCODER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_URL_ENCODER_H_
21 #include "net/instaweb/rewriter/cached_result.pb.h"
28 namespace net_instaweb {
31 class RequestProperties;
67 virtual void Encode(
const StringVector& urls,
68 const ResourceContext* dim,
71 virtual bool Decode(
const StringPiece& url_segment,
82 ResourceContext* resource_context);
90 ResourceContext* context);
98 ResourceContext* context);
102 const ResourceContext& resource_context);
104 static bool HasDimensions(
const ResourceContext& data) {
105 return (data.has_desired_image_dims() &&
106 HasValidDimensions(data.desired_image_dims()));
109 static bool HasValidDimensions(
const ImageDim& dims) {
110 return (dims.has_width() && dims.has_height());
113 static bool HasDimension(
const ResourceContext& data) {
114 return (data.has_desired_image_dims() &&
115 HasValidDimension(data.desired_image_dims()));
118 static bool HasValidDimension(
const ImageDim& dims) {
119 return (dims.has_width() || dims.has_height());
class GoogleUrl
Definition: google_url.h:58
static GoogleString CacheKeyFromResourceContext(const ResourceContext &resource_context)
Helper function to generate Metadata cache key from ResourceContext.
virtual bool Decode(const StringPiece &url_segment, StringVector *urls, ResourceContext *dim, MessageHandler *handler) const
static void SetSmallScreen(const RewriteDriver &driver, ResourceContext *context)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static void SetWebpAndMobileUserAgent(const RewriteDriver &driver, ResourceContext *context)
static void SetLibWebpLevel(const RewriteOptions &options, const RequestProperties &request_properties, ResourceContext *resource_context)
Definition: rewrite_driver.h:100
static bool IsWebpRewrittenUrl(const GoogleUrl &gurl)
Determines whether the given URL is a pagespeed-rewritten webp URL.
Definition: url_segment_encoder.h:33
Definition: message_handler.h:39
Definition: rewrite_options.h:84
virtual void Encode(const StringVector &urls, const ResourceContext *dim, GoogleString *rewritten_url) const
Definition: request_properties.h:37
Definition: image_url_encoder.h:62