Page Speed Optimization Libraries  1.11.33.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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"
19 #include "pagespeed/kernel/base/basictypes.h"
20 #include "pagespeed/kernel/base/gtest_prod.h"
21 #include "pagespeed/kernel/base/scoped_ptr.h"
22 #include "pagespeed/kernel/base/string_util.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  bool CanPreloadResources() const;
63  UserAgentMatcher::DeviceType GetDeviceType() const;
64  bool IsMobile() const;
65  bool IsTablet() const;
66  bool ForbidWebpInlining() const;
67  bool AcceptsGzip() const;
68  void LogDeviceInfo(AbstractLogRecord* log_record,
69  bool enable_aggressive_rewriters_for_mobile);
70  bool RequestsSaveData() const;
71  bool HasViaHeader() const;
72 
73  private:
74  friend class ImageRewriteTest;
75  FRIEND_TEST(RequestPropertiesTest, GetScreenGroupIndex);
76 
77  scoped_ptr<DeviceProperties> device_properties_;
78  scoped_ptr<DownstreamCachingDirectives> downstream_caching_directives_;
79 
80  mutable LazyBool supports_image_inlining_;
81  mutable LazyBool supports_js_defer_;
82  mutable LazyBool supports_lazyload_images_;
83  mutable LazyBool supports_webp_in_place_;
84  mutable LazyBool supports_webp_rewritten_urls_;
85  mutable LazyBool supports_webp_lossless_alpha_;
86  mutable LazyBool supports_webp_animated_;
87 
88 
89 };
90 
91 }
92 
93 #endif
void SetUserAgent(StringPiece user_agent_string)
Sets the user agent string on the underlying DeviceProperties object.
void ParseRequestHeaders(const RequestHeaders &request_headers)
Definition: request_properties.h:37