Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rewrite_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_FILTER_H_
21 
28 
29 namespace net_instaweb {
30 
31 class Resource;
32 class ResourceContext;
33 class RewriteContext;
34 class RewriteDriver;
35 class UrlSegmentEncoder;
36 
37 class RewriteFilter : public CommonFilter {
38  public:
39  explicit RewriteFilter(RewriteDriver* driver)
40  : CommonFilter(driver) {
41  }
42  virtual ~RewriteFilter();
43 
44  virtual const char* id() const = 0;
45 
50  virtual void DetermineEnabled(GoogleString* disabled_reason);
51 
56  virtual const UrlSegmentEncoder* encoder() const;
57 
64  virtual bool ComputeOnTheFly() const;
65 
70 
75  RewriteContext* parent, const ResourceSlotPtr& slot);
76 
81  ResourceContext* context) const {}
82 
95  static StringPiece GetCharsetForScript(const Resource* script,
96  const StringPiece attribute_charset,
97  const StringPiece enclosing_charset);
98 
111  static GoogleString GetCharsetForStylesheet(
112  const Resource* stylesheet,
113  const StringPiece attribute_charset,
114  const StringPiece enclosing_charset);
115 
131  virtual const RewriteOptions::Filter* RelatedFilters(int* num_filters) const;
132 
136  virtual const StringPieceVector* RelatedOptions() const {
137  return NULL;
138  }
139 
140  protected:
142  virtual const char* LoggingId() { return id(); }
143 
144  private:
149  virtual bool UsesPropertyCacheDomCohort() const { return false; }
150 
151  DISALLOW_COPY_AND_ASSIGN(RewriteFilter);
152 };
153 
154 }
155 
156 #endif
Definition: common_filter.h:48
virtual const UrlSegmentEncoder * encoder() const
virtual const StringPieceVector * RelatedOptions() const
Definition: rewrite_filter.h:136
virtual void DetermineEnabled(GoogleString *disabled_reason)
static StringPiece GetCharsetForScript(const Resource *script, const StringPiece attribute_charset, const StringPiece enclosing_charset)
Definition: resource.h:56
static GoogleString GetCharsetForStylesheet(const Resource *stylesheet, const StringPiece attribute_charset, const StringPiece enclosing_charset)
virtual void EncodeUserAgentIntoResourceContext(ResourceContext *context) const
Definition: rewrite_filter.h:80
Definition: rewrite_filter.h:37
virtual bool ComputeOnTheFly() const
Filter
Definition: rewrite_options.h:104
Definition: rewrite_driver.h:98
virtual const char * LoggingId()
This class logs using id().
Definition: rewrite_filter.h:142
Definition: rewrite_context.h:144
virtual const RewriteOptions::Filter * RelatedFilters(int *num_filters) const
virtual RewriteContext * MakeRewriteContext()
virtual RewriteContext * MakeNestedRewriteContext(RewriteContext *parent, const ResourceSlotPtr &slot)