Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
split_html_helper_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 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_SPLIT_HTML_HELPER_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_SPLIT_HTML_HELPER_FILTER_H_
21 
22 #include "base/logging.h"
24 #include "pagespeed/kernel/base/basictypes.h"
25 #include "pagespeed/kernel/base/scoped_ptr.h"
26 #include "pagespeed/kernel/base/string.h"
27 
28 namespace net_instaweb {
29 
30 class HtmlElement;
31 class RewriteDriver;
32 class SplitHtmlConfig;
33 class SplitHtmlState;
34 
44  public:
45  explicit SplitHtmlHelperFilter(RewriteDriver* rewrite_driver);
46  virtual ~SplitHtmlHelperFilter();
47 
48  virtual void DetermineEnabled(GoogleString* disabled_reason);
49 
50  virtual void StartDocumentImpl();
51  virtual void EndDocument();
52 
53  virtual void StartElementImpl(HtmlElement* element);
54  virtual void EndElementImpl(HtmlElement* element);
55 
56  const HtmlElement* current_panel_element() const {
57  return current_panel_element_;
58  }
59 
60  void set_current_panel_element(const HtmlElement* element) {
61  DCHECK(element == NULL || current_panel_element_ == NULL);
62  current_panel_element_ = element;
63  }
64 
65  virtual const char* Name() const { return "SplitHtmlHelperFilter"; }
66 
67  private:
69  void EndPanelInstance();
70 
72  void StartPanelInstance(HtmlElement* element, const GoogleString& panelid);
73 
74  const SplitHtmlConfig* config_;
75 
76  scoped_ptr<SplitHtmlState> state_;
77 
80  const HtmlElement* current_panel_element_;
81 
82  DISALLOW_COPY_AND_ASSIGN(SplitHtmlHelperFilter);
83 };
84 
85 }
86 
87 #endif
Definition: common_filter.h:48
Definition: split_html_config.h:50
Definition: rewrite_driver.h:98
Definition: split_html_helper_filter.h:43