Page Speed Optimization Libraries
1.4.26.1
|
#include "user_agent_matcher.h"
Public Types | |
enum | BlinkRequestType { kBlinkWhiteListForDesktop, kBlinkBlackListForDesktop, kBlinkWhiteListForMobile, kDoesNotSupportBlinkForMobile, kNullOrEmpty, kDoesNotSupportBlink } |
enum | DeviceType { kDesktop, kTablet, kMobile, kEndOfDeviceType } |
enum | PrefetchMechanism { kPrefetchNotSupported, kPrefetchLinkRelSubresource, kPrefetchImageTag, kPrefetchObjectTag, kPrefetchLinkScriptTag } |
Public Member Functions | |
bool | IsIe (const StringPiece &user_agent) const |
bool | IsIe6 (const StringPiece &user_agent) const |
bool | IsIe7 (const StringPiece &user_agent) const |
bool | IsIe6or7 (const StringPiece &user_agent) const |
bool | IsIe9 (const StringPiece &user_agent) const |
virtual bool | SupportsImageInlining (const StringPiece &user_agent) const |
bool | SupportsLazyloadImages (StringPiece user_agent) const |
virtual BlinkRequestType | GetBlinkRequestType (const char *user_agent, const RequestHeaders *request_headers) const |
PrefetchMechanism | GetPrefetchMechanism (const StringPiece &user_agent) const |
Returns the supported prefetch mechanism depending upon the user agent. | |
DeviceType | GetDeviceTypeForUA (const StringPiece &user_agent) const |
Returns the DeviceType for the given user agent string. | |
bool | SupportsJsDefer (const StringPiece &user_agent, bool allow_mobile) const |
bool | SupportsWebp (const StringPiece &user_agent) const |
bool | SupportsWebpLosslessAlpha (const StringPiece &user_agent) const |
bool | SupportsDnsPrefetchUsingRelPrefetch (const StringPiece &user_agent) const |
bool | SupportsDnsPrefetch (const StringPiece &user_agent) const |
virtual bool | IsMobileUserAgent (const StringPiece &user_agent) const |
virtual bool | IsMobileRequest (const StringPiece &user_agent, const RequestHeaders *request_headers) const |
virtual bool | IsAndroidUserAgent (const StringPiece &user_agent) const |
virtual bool | GetChromeBuildNumber (const StringPiece &user_agent, int *major, int *minor, int *build, int *patch) const |
virtual bool | SupportsSplitHtml (const StringPiece &user_agent, bool allow_mobile) const |
virtual bool | GetScreenResolution (const StringPiece &user_agent, int *width, int *height) |
Returns true and sets width and height if we know them for the UA. | |
bool | UserAgentExceedsChromeAndroidBuildAndPatch (const StringPiece &user_agent, int required_build, int required_patch) const |
Static Public Member Functions | |
static StringPiece | DeviceTypeSuffix (DeviceType device_type) |
Returns the suffix for the given device_type. | |
Static Public Attributes | |
static const char | kDevicePropertiesCohort [] |
Cohort descriptors for PropertyCache lookups of device objects. | |
static const char | kScreenWidth [] |
static const char | kScreenHeight [] |
This class contains various user agent based checks. Currently all of these are based on simple wildcard based white- and black-lists.
virtual BlinkRequestType net_instaweb::UserAgentMatcher::GetBlinkRequestType | ( | const char * | user_agent, |
const RequestHeaders * | request_headers | ||
) | const [virtual] |
Returns the request type for the given request. The return type currently supports desktop, mobile and not supported.
virtual bool net_instaweb::UserAgentMatcher::GetChromeBuildNumber | ( | const StringPiece & | user_agent, |
int * | major, | ||
int * | minor, | ||
int * | build, | ||
int * | patch | ||
) | const [virtual] |
Returns false if this is not a Chrome user agent, or parsing the string build number fails.
bool net_instaweb::UserAgentMatcher::SupportsDnsPrefetchUsingRelPrefetch | ( | const StringPiece & | user_agent | ) | const |
IE9 does not implement <link rel=dns-prefetch ...>. Instead it does DNS preresolution when it sees <link rel=prefetch ...>. This method returns true if the browser support DNS prefetch using rel=prefetch. Refer: http://blogs.msdn.com/b/ie/archive/2011/03/17/internet-explorer-9-network-performance-improvements.aspx NOLINT