18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_MAKE_SHOW_ADS_ASYNC_FILTER_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_MAKE_SHOW_ADS_ASYNC_FILTER_H_
22 #include "pagespeed/kernel/base/string.h"
23 #include "pagespeed/opt/ads/show_ads_snippet_parser.h"
24 #include "pagespeed/kernel/base/basictypes.h"
26 namespace net_instaweb {
28 class HtmlCharactersNode;
38 static const char kShowAdsSnippetsConverted[];
39 static const char kShowAdsSnippetsNotConverted[];
40 static const char kShowAdsApiReplacedForAsync[];
45 static void InitStats(Statistics* statistics);
49 virtual void StartElementImpl(HtmlElement* element);
50 virtual void EndElementImpl(HtmlElement* element);
53 virtual const char*
Name()
const {
54 return "MakeShowAdsAsyncFilter";
56 virtual void Characters(HtmlCharactersNode* characters);
66 bool IsApplicableShowAds(
67 const GoogleString& content,
68 ShowAdsSnippetParser::AttributeMap* parsed_attributes)
const;
73 void ReplaceShowAdsWithAdsByGoogleElement(
74 const ShowAdsSnippetParser::AttributeMap& parsed_attributes,
75 HtmlElement* show_ads_elment);
76 void ReplaceShowAdsApiCallWithAdsByGoogleApiCall(
77 HtmlElement* show_ads_elment);
80 HtmlElement* current_script_element_;
82 GoogleString current_script_element_contents_;
112 bool has_ads_by_google_js_;
118 int32 num_pending_show_ads_api_call_replacements_;
120 ShowAdsSnippetParser show_ads_snippet_parser_;
123 Variable* show_ads_snippets_converted_count_;
124 Variable* show_ads_snippets_not_converted_count_;
125 Variable* show_ads_api_replaced_for_async_;
Definition: common_filter.h:48
virtual const char * Name() const
Overrides HtmlFilter.
Definition: make_show_ads_async_filter.h:53
virtual void StartDocumentImpl()
Overrides CommonFilter.
Definition: rewrite_driver.h:98
virtual void Characters(HtmlCharactersNode *characters)
Definition: make_show_ads_async_filter.h:36