~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/net/instaweb/rewriter/public/scan_filter.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2011 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
 
// Author: jmarantz@google.com (Joshua Marantz)
18
 
 
19
 
#ifndef NET_INSTAWEB_REWRITER_PUBLIC_SCAN_FILTER_H_
20
 
#define NET_INSTAWEB_REWRITER_PUBLIC_SCAN_FILTER_H_
21
 
 
22
 
#include "net/instaweb/htmlparse/public/empty_html_filter.h"
23
 
 
24
 
namespace net_instaweb {
25
 
 
26
 
class HtmlCdataNode;
27
 
class HtmlCharactersNode;
28
 
class HtmlCommentNode;
29
 
class HtmlDirectiveNode;
30
 
class HtmlElement;
31
 
class HtmlIEDirectiveNode;
32
 
class RewriteDriver;
33
 
 
34
 
// Filter that is run before any other, to help track base-tag usage and
35
 
// changes to help identify and deal conservatively with situation where HTML
36
 
// files update the base-tag more than once or use the base-tag prior to it
37
 
// being changed.  Such situations are not well-defined and what we want to
38
 
// do is avoid rewriting any resources whose interpretation might be hard
39
 
// to predict due to browser differences.
40
 
class ScanFilter : public EmptyHtmlFilter {
41
 
 public:
42
 
  explicit ScanFilter(RewriteDriver* driver);
43
 
  virtual ~ScanFilter();
44
 
 
45
 
  virtual void StartDocument();
46
 
  virtual void StartElement(HtmlElement* element);
47
 
  virtual void Cdata(HtmlCdataNode* cdata);
48
 
  virtual void Comment(HtmlCommentNode* comment);
49
 
  virtual void IEDirective(HtmlIEDirectiveNode* directive);
50
 
  virtual void Characters(HtmlCharactersNode* characters);
51
 
  virtual void Directive(HtmlDirectiveNode* directive);
52
 
  virtual void Flush();
53
 
 
54
 
  virtual const char* Name() const { return "Scan"; }
55
 
 
56
 
 private:
57
 
  RewriteDriver* driver_;
58
 
  bool seen_any_nodes_;
59
 
  bool seen_refs_;
60
 
  bool seen_base_;
61
 
  bool seen_meta_tag_charset_;
62
 
};
63
 
 
64
 
}  // namespace net_instaweb
65
 
 
66
 
#endif  // NET_INSTAWEB_REWRITER_PUBLIC_SCAN_FILTER_H_