#include "user_agent_matcher.h"
|
bool | IsIe (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 DeviceType | GetDeviceTypeForUA (const StringPiece &user_agent) const |
| Returns the DeviceType for the given user agent string.
|
|
virtual DeviceType | GetDeviceTypeForUAAndHeaders (const StringPiece &user_agent, const RequestHeaders *request_headers) const |
|
bool | SupportsJsDefer (const StringPiece &user_agent, bool allow_mobile) const |
|
bool | LegacyWebp (const StringPiece &user_agent) const |
|
bool | SupportsWebpLosslessAlpha (const StringPiece &user_agent) const |
|
bool | SupportsWebpAnimated (const StringPiece &user_agent) const |
|
bool | SupportsDnsPrefetchUsingRelPrefetch (const StringPiece &user_agent) const |
|
bool | SupportsDnsPrefetch (const StringPiece &user_agent) const |
|
virtual bool | IsAndroidUserAgent (const StringPiece &user_agent) const |
|
virtual bool | IsiOSUserAgent (const StringPiece &user_agent) const |
|
virtual bool | GetChromeBuildNumber (const StringPiece &user_agent, int *major, int *minor, int *build, int *patch) const |
|
bool | UserAgentExceedsChromeAndroidBuildAndPatch (const StringPiece &user_agent, int required_build, int required_patch) const |
|
bool | UserAgentExceedsChromeiOSBuildAndPatch (const StringPiece &user_agent, int required_build, int required_patch) const |
|
bool | UserAgentExceedsChromeBuildAndPatch (const StringPiece &user_agent, int required_build, int required_patch) const |
|
bool | SupportsMobilization (StringPiece user_agent) const |
|
This class contains various user agent based checks. Currently all of these are based on simple wildcard based white- and black-lists.
- Todo:
- TODO(sriharis): Split the functionality here into two: a matcher that pulls out all relevant information from UA strings (browser-family, version, mobile/tablet/desktop, etc.), and a query interface that can be used by clients.
Enumerator |
---|
kEndOfDeviceType |
This should always be the last type. This is used to mark the size of an array containing various DeviceTypes.
|
static StringPiece net_instaweb::UserAgentMatcher::DeviceTypeString |
( |
DeviceType |
device_type | ) |
|
|
static |
Returns a string representing the device_type ("desktop", "tablet", or "mobile").
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.
virtual DeviceType net_instaweb::UserAgentMatcher::GetDeviceTypeForUAAndHeaders |
( |
const StringPiece & |
user_agent, |
|
|
const RequestHeaders * |
request_headers |
|
) |
| const |
|
virtual |
Returns the DeviceType using the given user agent string and request headers.
bool net_instaweb::UserAgentMatcher::IsIe |
( |
const StringPiece & |
user_agent | ) |
const |
Before calling IsIe, ask if you're doing the right thing: are you doing something that will mess up IE 11 in standards mode? Are you in a position where you can't tell what compatibility mode IE 11 is in? Right now we use this only to force edge compatibility mode and to work around a persistent IE Vary: caching bug.
bool net_instaweb::UserAgentMatcher::LegacyWebp |
( |
const StringPiece & |
user_agent | ) |
const |
Returns true if the user agent includes a legacy browser that supports webp, but does not issue Accept:image/webp. At the moment, this means only Android 4.0+ (excluding Firefox).
bool net_instaweb::UserAgentMatcher::SupportsDnsPrefetchUsingRelPrefetch |
( |
const StringPiece & |
user_agent | ) |
const |
bool net_instaweb::UserAgentMatcher::SupportsWebpAnimated |
( |
const StringPiece & |
user_agent | ) |
const |
Returns true if the user agent includes an animated WebP capable sub-string. If the browser does indeed support WebP, it also needs to send out an "accept: webp" header.
bool net_instaweb::UserAgentMatcher::SupportsWebpLosslessAlpha |
( |
const StringPiece & |
user_agent | ) |
const |
Returns true if the user agent includes a string indicating WebP lossy or WebP alpha support. If the browser does indeed support WebP, it also needs to send out an "accept: webp" header.
const char net_instaweb::UserAgentMatcher::kTestUserAgentNoWebP[] |
|
static |
Note that this must not contain the substring "webp".
non-webp user agent
const char net_instaweb::UserAgentMatcher::kTestUserAgentWebP[] |
|
static |
The documentation for this class was generated from the following file: