00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00017
00018 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_LIBRARY_IDENTIFICATION_H_
00019 #define NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_LIBRARY_IDENTIFICATION_H_
00020
00021 #include <cstddef>
00022
00023 #include "net/instaweb/util/public/basictypes.h"
00024 #include "net/instaweb/util/public/string_util.h"
00025
00026 namespace net_instaweb {
00027
00029 const size_t kJavascriptHashIdBlockSize = 512;
00030
00034 struct LibraryInfo {
00035 const char* name;
00036 const char* version;
00037 uint64 first_block_hash;
00038 uint64 full_hash;
00039 size_t full_size;
00040 };
00041
00047 class JavascriptLibraryId {
00048 public:
00050 JavascriptLibraryId();
00051
00054 static JavascriptLibraryId Find(const StringPiece& minified_code);
00055
00057 bool recognized() const {
00058 return info_->name != NULL;
00059 }
00060
00062 const char* name() const {
00063 return info_->name;
00064 }
00065
00067 const char* version() const {
00068 return info_->version;
00069 }
00070
00071 private:
00072 explicit JavascriptLibraryId(const LibraryInfo* info) : info_(info) { }
00073
00074 const LibraryInfo* info_;
00075 };
00076
00077 }
00078
00079 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_LIBRARY_IDENTIFICATION_H_