Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
collect_flush_early_content_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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  */
17 
18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_COLLECT_FLUSH_EARLY_CONTENT_FILTER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_COLLECT_FLUSH_EARLY_CONTENT_FILTER_H_
20 
23 #include "pagespeed/kernel/base/basictypes.h"
24 #include "pagespeed/kernel/base/string.h"
25 #include "pagespeed/kernel/base/string_util.h"
26 #include "pagespeed/kernel/html/html_name.h"
27 #include "pagespeed/kernel/http/semantic_type.h"
28 
29 namespace net_instaweb {
30 
31 class HtmlElement;
32 class RewriteDriver;
33 
44  public:
46 
47  virtual void StartDocumentImpl();
48  virtual void EndDocument();
49  virtual void StartElementImpl(HtmlElement* element);
50  virtual void EndElementImpl(HtmlElement* element);
51 
52  virtual const char* Name() const {
53  return "Collect Flush Early Content Filter";
54  }
55  virtual const char* id() const {
56  return RewriteOptions::kCollectFlushEarlyContentFilterId;
57  }
58 
59  protected:
60  virtual void Clear();
61 
62  private:
63  class Context;
64 
65  void AppendToHtml(StringPiece url, semantic_type::Category category,
66  HtmlElement* element);
67  void AppendAttribute(HtmlName::Keyword keyword, HtmlElement* element);
69  virtual bool UsesPropertyCacheDomCohort() const { return true; }
70 
72  bool found_resource_;
73  bool should_collect_critical_css_;
74  GoogleString resource_html_;
75 
76  DISALLOW_COPY_AND_ASSIGN(CollectFlushEarlyContentFilter);
77 };
78 
79 }
80 
81 #endif
Definition: rewrite_filter.h:37
Definition: rewrite_driver.h:98
Definition: collect_flush_early_content_filter.h:43