Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
request_properties.h
1 // Copyright 2013 Google Inc. All Rights Reserved.
14 
15 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REQUEST_PROPERTIES_H_
16 #define NET_INSTAWEB_REWRITER_PUBLIC_REQUEST_PROPERTIES_H_
17 
18 #include "net/instaweb/rewriter/public/device_properties.h"
23 #include "pagespeed/kernel/http/user_agent_matcher.h"
24 
25 namespace net_instaweb {
26 
27 class DownstreamCachingDirectives;
28 class AbstractLogRecord;
29 class RequestHeaders;
30 
38  public:
39  explicit RequestProperties(UserAgentMatcher* matcher);
40  virtual ~RequestProperties();
41 
43  void SetUserAgent(StringPiece user_agent_string);
46  void ParseRequestHeaders(const RequestHeaders& request_headers);
47 
48  bool SupportsImageInlining() const;
49  bool SupportsLazyloadImages() const;
50  bool SupportsCriticalCss() const;
51  bool SupportsCriticalCssBeacon() const;
52  bool SupportsCriticalImagesBeacon() const;
53  bool SupportsJsDefer(bool enable_mobile) const;
57  bool SupportsWebpInPlace() const;
58  bool SupportsWebpRewrittenUrls() const;
59  bool SupportsWebpLosslessAlpha() const;
60  bool SupportsWebpAnimated() const;
61  bool IsBot() const;
62  UserAgentMatcher::DeviceType GetDeviceType() const;
63  bool IsMobile() const;
64  bool IsTablet() const;
65  bool ForbidWebpInlining() const;
66  bool AcceptsGzip() const;
67  void LogDeviceInfo(AbstractLogRecord* log_record,
68  bool enable_aggressive_rewriters_for_mobile);
69  bool RequestsSaveData() const;
70  bool HasViaHeader() const;
71 
72  private:
73  friend class ImageRewriteTest;
74  FRIEND_TEST(RequestPropertiesTest, GetScreenGroupIndex);
75 
76  scoped_ptr<DeviceProperties> device_properties_;
77  scoped_ptr<DownstreamCachingDirectives> downstream_caching_directives_;
78 
79  mutable LazyBool supports_image_inlining_;
80  mutable LazyBool supports_js_defer_;
81  mutable LazyBool supports_lazyload_images_;
82  mutable LazyBool supports_webp_in_place_;
83  mutable LazyBool supports_webp_rewritten_urls_;
84  mutable LazyBool supports_webp_lossless_alpha_;
85  mutable LazyBool supports_webp_animated_;
86 
87 
88 };
89 
90 }
91 
92 #endif
Read/write API for HTTP request (RequestHeaders is a misnomer).
Definition: request_headers.h:32
Definition: user_agent_matcher.h:43
Definition: log_record.h:59
Definition: scoped_ptr.h:30
LazyBool
Lazily-initialized boolean value.
Definition: basictypes.h:68
void SetUserAgent(StringPiece user_agent_string)
Sets the user agent string on the underlying DeviceProperties object.
DeviceType
Definition: user_agent_matcher.h:49
void ParseRequestHeaders(const RequestHeaders &request_headers)
Definition: request_properties.h:37