Page Speed Optimization Libraries  1.13.35.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 AsyncFetch;
28 class GoogleUrl;
29 class OutputResource;
30 class RequestHeaders;
31 class RewriteOptions;
32 
38 class UrlNamer {
39  public:
40  enum EncodeOption {
41  kSharded,
42  kUnsharded
43  };
44 
47  enum class ProxyExtent {
48  kNone,
49  kInputOnly,
50  kFull,
52  };
53 
54  UrlNamer();
55  virtual ~UrlNamer();
56 
64  virtual GoogleString Encode(const RewriteOptions* rewrite_options,
65  const OutputResource& output_resource,
66  EncodeOption encode_option) const;
67 
74  virtual bool Decode(const GoogleUrl& request_url,
75  const RewriteOptions* rewrite_options,
76  GoogleString* decoded) const;
77 
82  virtual bool IsAuthorized(const GoogleUrl& request_url,
83  const RewriteOptions& options) const;
84 
86  virtual void ConfigureCustomOptions(const RequestHeaders& request_headers,
87  RewriteOptions* options) const {}
88 
91  virtual ProxyExtent ProxyMode() const { return ProxyExtent::kNone; }
92 
95  virtual bool IsProxyEncoded(const GoogleUrl& url) const { return false; }
96 
98  virtual void PrepForCrossDomain(AsyncFetch*) const { }
99 
100  const GoogleString& proxy_domain() const { return proxy_domain_; }
101 
102  void set_proxy_domain(const GoogleString& proxy_domain) {
103  proxy_domain_ = proxy_domain;
104  }
105 
106  private:
107  GoogleString proxy_domain_;
108 
109 
110 };
111 
112 }
113 
114 #endif
Definition: url_namer.h:38
class GoogleUrl
Definition: google_url.h:58
Read/write API for HTTP request (RequestHeaders is a misnomer).
Definition: request_headers.h:32
virtual void PrepForCrossDomain(AsyncFetch *) const
Prepare Fetch for cross-domain request.
Definition: url_namer.h:98
virtual void ConfigureCustomOptions(const RequestHeaders &request_headers, RewriteOptions *options) const
Configure custom options. Note that options may be NULL.
Definition: url_namer.h:86
ProxyExtent
Definition: url_namer.h:47
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
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
Definition: async_fetch.h:53
virtual ProxyExtent ProxyMode() const
Definition: url_namer.h:91
virtual bool IsProxyEncoded(const GoogleUrl &url) const
Definition: url_namer.h:95
Definition: output_resource.h:44
virtual bool Decode(const GoogleUrl &request_url, const RewriteOptions *rewrite_options, GoogleString *decoded) const
Definition: rewrite_options.h:84