Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
url_partnership.h
1 /*
2  * Copyright 2010 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 
17 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_URL_PARTNERSHIP_H_
18 #define NET_INSTAWEB_REWRITER_PUBLIC_URL_PARTNERSHIP_H_
19 
20 #include <vector>
21 
26 
27 namespace net_instaweb {
28 
29 class MessageHandler;
30 class RewriteDriver;
31 class RewriteOptions;
32 class UrlNamer;
33 
42  public:
43  explicit UrlPartnership(const RewriteDriver* driver);
44  virtual ~UrlPartnership();
45 
48  bool AddUrl(const StringPiece& resource_url, MessageHandler* handler);
49 
52  GoogleString ResolvedBase() const;
53 
55  int num_urls() const { return url_vector_.size(); }
56 
59  GoogleString RelativePath(int index) const;
60 
62  const GoogleUrl* FullPath(int index) const { return url_vector_[index]; }
63 
65  void RemoveLast();
66 
70  virtual void Reset(const GoogleUrl& original_request);
71 
74  int NumCommonComponents() const { return common_components_.size(); }
75 
81  static bool FindResourceDomain(const GoogleUrl& base_url,
82  const UrlNamer* url_namer,
83  const RewriteOptions* rewrite_options,
84  GoogleUrl* resource,
85  GoogleString* domain,
86  MessageHandler* handler);
87 
88  protected:
89  const RewriteOptions* rewrite_options() const { return rewrite_options_; }
90 
91  private:
95  void IncrementalResolve(int index);
96 
97  typedef std::vector<GoogleUrl*> GurlVector;
98  GurlVector url_vector_;
99  GoogleString domain_and_path_prefix_;
100  const RewriteOptions* rewrite_options_;
101  const UrlNamer* url_namer_;
102  GoogleUrl original_origin_and_path_;
103 
106  StringVector common_components_;
107 
108 
109 };
110 
111 }
112 
113 #endif
Definition: url_namer.h:38
static bool FindResourceDomain(const GoogleUrl &base_url, const UrlNamer *url_namer, const RewriteOptions *rewrite_options, GoogleUrl *resource, GoogleString *domain, MessageHandler *handler)
class GoogleUrl
Definition: google_url.h:58
const GoogleUrl * FullPath(int index) const
Returns the full resolved path.
Definition: url_partnership.h:62
Definition: url_partnership.h:41
int num_urls() const
Returns the number of URLs that have been successfully added.
Definition: url_partnership.h:55
bool AddUrl(const StringPiece &resource_url, MessageHandler *handler)
GoogleString RelativePath(int index) const
int NumCommonComponents() const
Definition: url_partnership.h:74
virtual void Reset(const GoogleUrl &original_request)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: rewrite_driver.h:100
GoogleString ResolvedBase() const
Definition: message_handler.h:39
void RemoveLast()
Removes the last URL that was added to the partnership.
Definition: rewrite_options.h:84