00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_
00020 #define NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_
00021
00022 #include "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/string.h"
00024
00025 namespace net_instaweb {
00026
00027 class Function;
00028 class GoogleUrl;
00029 class OutputResource;
00030 class MessageHandler;
00031 class RequestHeaders;
00032 class RewriteOptions;
00033
00039 class UrlNamer {
00040 public:
00041 class Callback {
00042 public:
00043 Callback() {}
00044 virtual ~Callback();
00048 virtual void Done(RewriteOptions* rewrite_options) = 0;
00049
00050 private:
00051 DISALLOW_COPY_AND_ASSIGN(Callback);
00052 };
00053 UrlNamer();
00054 virtual ~UrlNamer();
00055
00060 virtual GoogleString Encode(const RewriteOptions* rewrite_options,
00061 const OutputResource& output_resource) const;
00062
00070 virtual bool Decode(const GoogleUrl& request_url,
00071 GoogleUrl* owner_domain,
00072 GoogleString* decoded) const;
00073
00078 virtual bool IsAuthorized(const GoogleUrl& request_url,
00079 const RewriteOptions& options) const;
00080
00082 virtual void DecodeOptions(const GoogleUrl& request_url,
00083 const RequestHeaders& request_headers,
00084 Callback* callback,
00085 MessageHandler* handler) const;
00086
00088 virtual void PrepareRequest(const RewriteOptions* rewrite_options,
00089 GoogleString* url,
00090 RequestHeaders* request_headers,
00091 bool* success,
00092 Function* func, MessageHandler* handler);
00093
00096 virtual bool ProxyMode() const { return false; }
00097
00100 virtual bool IsProxyEncoded(const GoogleUrl& url) const { return false; }
00101
00102 const GoogleString& get_proxy_domain() {
00103 return proxy_domain_;
00104 }
00105
00106 void set_proxy_domain(const GoogleString proxy_domain) {
00107 proxy_domain_ = proxy_domain;
00108 }
00109
00110 private:
00111 GoogleString proxy_domain_;
00112
00113 DISALLOW_COPY_AND_ASSIGN(UrlNamer);
00114 };
00115
00116 }
00117
00118 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_