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

#include "device_properties.h"

Public Types

enum  ImageQualityPreference { kImageQualityDefault, kImageQualityLow, kImageQualityMedium, kImageQualityHigh }
 

Public Member Functions

 DeviceProperties (UserAgentMatcher *matcher)
 
void SetUserAgent (const StringPiece &user_agent_string)
 
void ParseRequestHeaders (const RequestHeaders &request_headers)
 
bool SupportsImageInlining () const
 
bool SupportsLazyloadImages () const
 
bool SupportsCriticalCss () const
 
bool SupportsCriticalImagesBeacon () const
 
bool SupportsJsDefer (bool enable_mobile) const
 
bool SupportsWebpInPlace () const
 
bool SupportsWebpRewrittenUrls () const
 
bool SupportsWebpLosslessAlpha () const
 
bool SupportsWebpAnimated () const
 
bool IsBot () const
 
bool AcceptsGzip () const
 
UserAgentMatcher::DeviceType GetDeviceType () const
 
bool IsMobile () const
 
bool IsTablet () const
 
bool ForbidWebpInlining () const
 
bool RequestsSaveData () const
 
bool HasViaHeader () const
 

Static Public Attributes

static const int kMediumScreenWidthThreshold = 720
 
static const int kLargeScreenWidthThreshold = 1500
 

Friends

class ImageRewriteTest
 
class RequestProperties
 

Detailed Description

This class keeps track of the device properties of the client, which are for the most part learned from the UserAgent string.

Member Enumeration Documentation

Enumerator
kImageQualityDefault 

Server uses its own default image quality.

kImageQualityLow 

The request asks for low image quality.

kImageQualityMedium 

The request asks for medium image quality.

kImageQualityHigh 

The request asks for high image quality.

Member Function Documentation

void net_instaweb::DeviceProperties::ParseRequestHeaders ( const RequestHeaders request_headers)

Set device-based properties that are capture in the request headers (eg. the Accept: header).

bool net_instaweb::DeviceProperties::SupportsWebpInPlace ( ) const

SupportsWebpInPlace indicates we saw an Accept: image/webp header, and can rewrite the request in place (using Vary: accept in the result headers, etc.).

bool net_instaweb::DeviceProperties::SupportsWebpRewrittenUrls ( ) const

SupportsWebpRewrittenUrls indicates that the device can handle webp so long as the url changes - either we know this based on user agent, or we got an Accept header. We can't tell a proxy cache to distinguish this case using Vary: accept in the result headers, as we can't guarantee we'll see such a header, ever. So we need to Vary: user-agent or cache-control: private, and thus restrict it to rewritten urls.


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