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

Side by Side Diff: src/plugin/AdblockPlusClient.h

Issue 10845030: Marshal all libadblockplus calls to the engine process (Closed)
Patch Set: Created May 31, 2013, 2:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef _SIMPLE_ADBLOCK_CLIENT_H_ 1 #ifndef _SIMPLE_ADBLOCK_CLIENT_H_
2 #define _SIMPLE_ADBLOCK_CLIENT_H_ 2 #define _SIMPLE_ADBLOCK_CLIENT_H_
3 3
4 4
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 #include "PluginClientBase.h" 6 #include "PluginClientBase.h"
7 #include "AdblockPlus.h"
8 7
9 8
10 using namespace AdblockPlus; 9 class CPluginFilter;
11 10
12 class CPluginFilter; 11 struct SubscriptionDescription
12 {
13 std::string url;
14 std::string title;
15 std::string specialization;
16 bool listed;
17 };
13 18
14 class CAdblockPlusClient : public CPluginClientBase 19 class CAdblockPlusClient : public CPluginClientBase
15 { 20 {
16 21
17 private: 22 private:
18 23
19 std::auto_ptr<CPluginFilter> m_filter; 24 std::auto_ptr<CPluginFilter> m_filter;
20 std::auto_ptr<AdblockPlus::FilterEngine> filterEngine;
21 25
22 CComAutoCriticalSection m_criticalSectionFilter; 26 CComAutoCriticalSection m_criticalSectionFilter;
23 CComAutoCriticalSection m_criticalSectionCache; 27 CComAutoCriticalSection m_criticalSectionCache;
24 28
25 std::map<CString,bool> m_cacheBlockedSources; 29 std::map<CString,bool> m_cacheBlockedSources;
26 30
27 31
28 // Private constructor used by the singleton pattern 32 // Private constructor used by the singleton pattern
29 CAdblockPlusClient(); 33 CAdblockPlusClient();
30 34
31 public: 35 public:
32 36
33 static CAdblockPlusClient* s_instance; 37 static CAdblockPlusClient* s_instance;
34 38
35 ~CAdblockPlusClient(); 39 ~CAdblockPlusClient();
36 40
37 static CAdblockPlusClient* GetInstance(); 41 static CAdblockPlusClient* GetInstance();
38 42
39 // Removes the url from the list of whitelisted urls if present 43 // Removes the url from the list of whitelisted urls if present
40 // Only called from ui thread 44 // Only called from ui thread
41 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false); 45 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false);
42 46
43 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter); 47 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter);
44 bool IsUrlWhiteListed(const CString& url); 48 bool IsUrlWhiteListed(const CString& url);
45 49
46 int GetIEVersion(); 50 int GetIEVersion();
47 51
48 bool Matches(const std::string& url, const std::string& contentType, const std ::string& domain); 52 bool Matches(const std::string& url, const std::string& contentType, const std ::string& domain);
49 std::vector<std::string> GetElementHidingSelectors(const std::string& domain); 53 std::vector<std::string> GetElementHidingSelectors(const std::string& domain);
50 std::vector<AdblockPlus::SubscriptionPtr> FetchAvailableSubscriptions(); 54 std::vector<SubscriptionDescription> FetchAvailableSubscriptions();
51 std::vector<AdblockPlus::FilterPtr> GetListedFilters(); 55 std::vector<SubscriptionDescription> GetListedSubscriptions();
52 AdblockPlus::FilterPtr GetFilter(std::string text); 56 void SetSubscription(std::string url);
53 std::vector<AdblockPlus::SubscriptionPtr> GetListedSubscriptions(); 57 void UpdateAllSubscriptions();
54 AdblockPlus::SubscriptionPtr GetSubscription(std::string url); 58 std::vector<std::string> GetExceptionDomains();
59 void AddFilter(const std::string& text);
55 }; 60 };
56 61
57 #endif // _SIMPLE_ADBLOCK_CLIENT_H_ 62 #endif // _SIMPLE_ADBLOCK_CLIENT_H_
OLDNEW
« src/engine/main.cpp ('K') | « src/engine/main.cpp ('k') | src/plugin/AdblockPlusClient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld