Page Speed Optimization Libraries
1.2.24.1
|
00001 /* 00002 * Copyright 2010 Google Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http:///www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00018 00019 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_FILTER_H_ 00020 #define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_FILTER_H_ 00021 00022 #include "net/instaweb/rewriter/public/common_filter.h" 00023 #include "net/instaweb/rewriter/public/resource.h" 00024 #include "net/instaweb/rewriter/public/resource_slot.h" 00025 #include "net/instaweb/util/public/basictypes.h" 00026 #include "net/instaweb/util/public/string.h" 00027 #include "net/instaweb/util/public/string_util.h" 00028 00029 namespace net_instaweb { 00030 00031 class OutputResource; 00032 class RewriteContext; 00033 class RewriteDriver; 00034 class UrlSegmentEncoder; 00035 00036 class RewriteFilter : public CommonFilter { 00037 public: 00038 explicit RewriteFilter(RewriteDriver* driver) 00039 : CommonFilter(driver) { 00040 } 00041 virtual ~RewriteFilter(); 00042 00043 virtual const char* id() const = 0; 00044 00049 virtual void DetermineEnabled(); 00050 00053 ResourcePtr CreateInputResourceFromOutputResource( 00054 OutputResource* output_resource); 00055 00060 virtual const UrlSegmentEncoder* encoder() const; 00061 00068 virtual bool ComputeOnTheFly() const; 00069 00073 virtual RewriteContext* MakeRewriteContext(); 00074 00078 virtual RewriteContext* MakeNestedRewriteContext( 00079 RewriteContext* parent, const ResourceSlotPtr& slot); 00080 00093 static StringPiece GetCharsetForScript(const Resource* script, 00094 const StringPiece attribute_charset, 00095 const StringPiece enclosing_charset); 00096 00109 static GoogleString GetCharsetForStylesheet( 00110 const Resource* stylesheet, 00111 const StringPiece attribute_charset, 00112 const StringPiece enclosing_charset); 00113 00116 virtual void LogFilterModifiedContent(); 00117 00118 private: 00123 virtual bool UsesPropertyCacheDomCohort() const { return false; } 00124 00125 DISALLOW_COPY_AND_ASSIGN(RewriteFilter); 00126 }; 00127 00128 } 00129 00130 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_FILTER_H_