Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_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_TEST_URL_NAMER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_TEST_URL_NAMER_H_
21 
23 
27 
28 namespace net_instaweb {
29 
30 class GoogleUrl;
31 class OutputResource;
32 class ResourceNamer;
33 class RewriteOptions;
34 
37 class TestUrlNamer : public UrlNamer {
38  public:
39  TestUrlNamer();
40  virtual ~TestUrlNamer();
41 
42  virtual GoogleString Encode(const RewriteOptions* rewrite_options,
43  const OutputResource& output_resource,
44  EncodeOption encode_option) const;
45 
46  bool Decode(const GoogleUrl& request_url,
47  const RewriteOptions* rewrite_options,
48  GoogleString* decoded) const override;
49 
50  static GoogleString EncodeUrl(const StringPiece& original_base,
51  const StringPiece& unmapped_base,
52  const StringPiece& resolved_path,
53  const ResourceNamer& leaf_details);
54 
57  ProxyExtent ProxyMode() const override { return proxy_mode_; }
58 
60  virtual bool IsProxyEncoded(const GoogleUrl& url) const;
61 
63  static void SetProxyMode(ProxyExtent value) { proxy_mode_ = value; }
64 
67  static void UseNormalEncoding(bool yes) {
68  use_normal_encoding_ = yes;
69  }
70 
71  static bool UseNormalEncoding() { return use_normal_encoding_; }
72 
73  private:
74  bool IsOriginEncoded(const GoogleUrl& url) const;
75  bool IsPathEncoded(const GoogleUrl& url) const;
76 
77  static bool use_normal_encoding_;
78  static ProxyExtent proxy_mode_;
79 
80 
81 };
82 
83 }
84 
85 #endif
Definition: url_namer.h:38
class GoogleUrl
Definition: google_url.h:58
virtual GoogleString Encode(const RewriteOptions *rewrite_options, const OutputResource &output_resource, EncodeOption encode_option) const
ProxyExtent
Definition: url_namer.h:47
Definition: test_url_namer.h:37
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual bool IsProxyEncoded(const GoogleUrl &url) const
Determines whether the specified URL has been mapped to our proxy domain.
static void SetProxyMode(ProxyExtent value)
Set whether a test needs the URL namer to act in proxy mode.
Definition: test_url_namer.h:63
Definition: output_resource.h:44
bool Decode(const GoogleUrl &request_url, const RewriteOptions *rewrite_options, GoogleString *decoded) const override
ProxyExtent ProxyMode() const override
Definition: test_url_namer.h:57
static void UseNormalEncoding(bool yes)
Definition: test_url_namer.h:67
Definition: rewrite_options.h:84
Definition: resource_namer.h:32