Page Speed Optimization Libraries  1.11.33.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
iframe_fetcher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 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_IFRAME_FETCHER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_IFRAME_FETCHER_H_
21 
24 #include "pagespeed/kernel/base/string.h"
25 #include "pagespeed/kernel/http/user_agent_matcher.h"
26 
27 namespace net_instaweb {
28 
29 class AsyncFetch;
30 class MessageHandler;
31 
35  public:
37  static const char kIframeId[];
38 
39  IframeFetcher(const RewriteOptions* options, const UserAgentMatcher* matcher,
40  UrlAsyncFetcher* proxy_fetcher);
41 
42  virtual ~IframeFetcher();
43  virtual void Fetch(const GoogleString& url,
44  MessageHandler* message_handler,
45  AsyncFetch* fetch);
46 
47  private:
48  bool SupportedDevice(const char* user_agent) const;
49  void RespondWithIframe(const GoogleString& escaped_url,
50  AsyncFetch* fetch,
51  MessageHandler* message_handler);
52  void RespondWithRedirect(const GoogleString& url,
53  const GoogleString& escaped_url,
54  AsyncFetch* fetch,
55  MessageHandler* message_handler);
56  void RespondWithError(const GoogleString& escaped_url,
57  AsyncFetch* fetch,
58  MessageHandler* message_handler);
59 
60  const RewriteOptions* options_;
61  const UserAgentMatcher* user_agent_matcher_;
62  UrlAsyncFetcher* proxy_fetcher_;
63 };
64 
65 }
66 
67 #endif
Definition: iframe_fetcher.h:34
static const char kIframeId[]
Id of iframe element inserted by fetcher.
Definition: iframe_fetcher.h:37
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
Definition: async_fetch.h:53
Definition: rewrite_options.h:84
Definition: url_async_fetcher.h:33