Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mobilize_label_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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_MOBILIZE_LABEL_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_MOBILIZE_LABEL_FILTER_H_
21 
24 #include "pagespeed/kernel/base/basictypes.h"
25 
26 namespace net_instaweb {
27 
28 class HtmlElement;
29 class RewriteDriver;
30 class Statistics;
31 class Variable;
32 
49  public:
51  static const char kPagesLabeled[];
52  static const char kPagesRoleAdded[];
53  static const char kNavigationalRoles[];
54  static const char kHeaderRoles[];
55  static const char kContentRoles[];
56  static const char kMarginalRoles[];
57 
58  explicit MobilizeLabelFilter(RewriteDriver* driver);
59  virtual ~MobilizeLabelFilter();
60 
61  static void InitStats(Statistics* statistics);
62 
63  virtual const char* Name() const { return "MobilizeLabel"; }
64  virtual void StartDocumentImpl();
65  virtual void StartElementImpl(HtmlElement* element);
66  virtual void EndElementImpl(HtmlElement* element);
67  virtual void EndDocument();
68 
69  private:
70  void SetMobileRole(HtmlElement* element, MobileRole::Level level);
71 
72  HtmlElement* active_no_traverse_element_;
73  HtmlElement* active_no_label_element_;
74  bool were_roles_added_;
75 
76  Variable* pages_labeled_;
77  Variable* pages_role_added_;
78  Variable* role_variables_[MobileRole::kInvalid];
79 
80  DISALLOW_COPY_AND_ASSIGN(MobilizeLabelFilter);
81 };
82 
83 }
84 
85 #endif
Definition: common_filter.h:48
static const char kPagesLabeled[]
Monitoring variable names.
Definition: mobilize_label_filter.h:51
Definition: mobilize_rewrite_filter.h:57
Definition: mobilize_label_filter.h:48
Level
Definition: mobilize_rewrite_filter.h:39
Definition: rewrite_driver.h:98