Page Speed Optimization Libraries  1.5.27.2
net/instaweb/rewriter/public/file_load_policy.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 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_FILE_LOAD_POLICY_H_
00020 #define NET_INSTAWEB_REWRITER_PUBLIC_FILE_LOAD_POLICY_H_
00021 
00022 #include <list>
00023 #include "net/instaweb/util/public/basictypes.h"
00024 #include "net/instaweb/util/public/gtest_prod.h"
00025 #include "net/instaweb/util/public/string.h"
00026 #include "net/instaweb/util/public/string_util.h"
00027 
00028 namespace net_instaweb {
00029 
00030 class GoogleUrl;
00031 class FileLoadMapping;
00032 class FileLoadRule;
00033 
00038 class FileLoadPolicy {
00039  public:
00040   FileLoadPolicy() {}
00041   virtual ~FileLoadPolicy();
00042 
00045   virtual bool ShouldLoadFromFile(const GoogleUrl& url,
00046                                   GoogleString* filename) const;
00047 
00055   virtual void Associate(const StringPiece& url_prefix,
00056                          const StringPiece& filename_prefix);
00057 
00072   virtual bool AssociateRegexp(const StringPiece& url_regexp,
00073                                const StringPiece& filename_prefix,
00074                                GoogleString* error);
00075 
00106   virtual bool AddRule(const GoogleString& rule, bool is_regexp, bool allowed,
00107                        GoogleString* error);
00108 
00110   virtual void Merge(const FileLoadPolicy& other);
00111 
00112  private:
00113   typedef std::list<FileLoadMapping*> FileLoadMappings;
00114   FileLoadMappings file_load_mappings_;
00115   typedef std::list<FileLoadRule*> FileLoadRules;
00116   FileLoadRules file_load_rules_;
00117 
00118   DISALLOW_COPY_AND_ASSIGN(FileLoadPolicy);
00119 };
00120 
00121 }  
00122 
00123 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_FILE_LOAD_POLICY_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines