Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/FilterEngine.cpp

Issue 10100009: FilterEngine API improvements (Closed)
Patch Set: Changed filter type enum Created April 9, 2013, 5:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « shell/src/FiltersCommand.cpp ('k') | test/FilterEngineStubs.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <algorithm> 1 #include <algorithm>
2 #include <AdblockPlus.h> 2 #include <AdblockPlus.h>
3 3
4 using namespace AdblockPlus; 4 using namespace AdblockPlus;
5 5
6 #if !FILTER_ENGINE_STUBS 6 #if !FILTER_ENGINE_STUBS
7 extern const char* jsSources[]; 7 extern const char* jsSources[];
8 #endif 8 #endif
9 9
10 #if FILTER_ENGINE_STUBS 10 #if FILTER_ENGINE_STUBS
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 boolProperties[name] = value; 71 boolProperties[name] = value;
72 #endif 72 #endif
73 } 73 }
74 74
75 #if FILTER_ENGINE_STUBS 75 #if FILTER_ENGINE_STUBS
76 Filter::Filter(FilterEngine& filterEngine, const std::string& text) 76 Filter::Filter(FilterEngine& filterEngine, const std::string& text)
77 : JsObject(filterEngine) 77 : JsObject(filterEngine)
78 { 78 {
79 SetProperty("text", text); 79 SetProperty("text", text);
80 if (text.find("!") == 0) 80 if (text.find("!") == 0)
81 SetProperty("type", COMMENT_RULE); 81 SetProperty("type", TYPE_COMMENT);
82 else if (text.find("@@") == 0) 82 else if (text.find("@@") == 0)
83 SetProperty("type", EXCEPTION_RULE); 83 SetProperty("type", TYPE_EXCEPTION);
84 else if (text.find("#@") != std::string::npos) 84 else if (text.find("#@") != std::string::npos)
85 SetProperty("type", ELEMHIDE_EXCEPTION_RULE); 85 SetProperty("type", TYPE_ELEMHIDE_EXCEPTION);
86 else if (text.find("#") != std::string::npos) 86 else if (text.find("#") != std::string::npos)
87 SetProperty("type", ELEMHIDE_RULE); 87 SetProperty("type", TYPE_ELEMHIDE);
88 else 88 else
89 SetProperty("type", BLOCKING_RULE); 89 SetProperty("type", TYPE_BLOCKING);
90 } 90 }
91 #else 91 #else
92 Filter::Filter() 92 Filter::Filter()
93 { 93 {
94 } 94 }
95 #endif 95 #endif
96 96
97 bool Filter::IsListed() const 97 bool Filter::IsListed() const
98 { 98 {
99 #if FILTER_ENGINE_STUBS 99 #if FILTER_ENGINE_STUBS
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 #if FILTER_ENGINE_STUBS 266 #if FILTER_ENGINE_STUBS
267 std::vector<std::string> selectors; 267 std::vector<std::string> selectors;
268 selectors.push_back("#ad"); 268 selectors.push_back("#ad");
269 selectors.push_back(".ad"); 269 selectors.push_back(".ad");
270 //For test on http://simple-adblock.com/faq/testing-your-adblocker/ 270 //For test on http://simple-adblock.com/faq/testing-your-adblocker/
271 if (domain == "simple-adblock.com") 271 if (domain == "simple-adblock.com")
272 selectors.push_back(".ad_300x250"); 272 selectors.push_back(".ad_300x250");
273 return selectors; 273 return selectors;
274 #endif 274 #endif
275 } 275 }
OLDNEW
« no previous file with comments | « shell/src/FiltersCommand.cpp ('k') | test/FilterEngineStubs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld