Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
url_namer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 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_URL_NAMER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_
21 
24 
25 namespace net_instaweb {
26 
27 class GoogleUrl;
28 class OutputResource;
29 class RequestHeaders;
30 class RewriteOptions;
31 
37 class UrlNamer {
38  public:
39  enum EncodeOption {
40  kSharded,
41  kUnsharded
42  };
43 
44  UrlNamer();
45  virtual ~UrlNamer();
46 
54  virtual GoogleString Encode(const RewriteOptions* rewrite_options,
55  const OutputResource& output_resource,
56  EncodeOption encode_option) const;
57 
66  virtual bool Decode(const GoogleUrl& request_url,
67  const RewriteOptions* rewrite_options,
68  GoogleUrl* owner_domain,
69  GoogleString* decoded) const;
70 
75  virtual bool IsAuthorized(const GoogleUrl& request_url,
76  const RewriteOptions& options) const;
77 
79  virtual void ConfigureCustomOptions(const RequestHeaders& request_headers,
80  RewriteOptions* options) const {}
81 
84  virtual bool ProxyMode() const { return false; }
85 
88  virtual bool IsProxyEncoded(const GoogleUrl& url) const { return false; }
89 
90  const GoogleString& proxy_domain() const { return proxy_domain_; }
91 
92  void set_proxy_domain(const GoogleString& proxy_domain) {
93  proxy_domain_ = proxy_domain;
94  }
95 
96  private:
97  GoogleString proxy_domain_;
98 
99  DISALLOW_COPY_AND_ASSIGN(UrlNamer);
100 };
101 
102 }
103 
104 #endif
Definition: url_namer.h:37
virtual void ConfigureCustomOptions(const RequestHeaders &request_headers, RewriteOptions *options) const
Configure custom options. Note that options may be NULL.
Definition: url_namer.h:79
virtual bool Decode(const GoogleUrl &request_url, const RewriteOptions *rewrite_options, GoogleUrl *owner_domain, GoogleString *decoded) const
virtual GoogleString Encode(const RewriteOptions *rewrite_options, const OutputResource &output_resource, EncodeOption encode_option) const
virtual bool IsAuthorized(const GoogleUrl &request_url, const RewriteOptions &options) const
virtual bool IsProxyEncoded(const GoogleUrl &url) const
Definition: url_namer.h:88
virtual bool ProxyMode() const
Definition: url_namer.h:84
Definition: output_resource.h:44
Definition: rewrite_options.h:81