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

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

Issue 10948032: Fix domain-based whitelisting (Closed)
Patch Set: Created June 14, 2013, 2:44 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 _PLUGIN_CLIENT_BASE_H_ 1 #ifndef _PLUGIN_CLIENT_BASE_H_
2 #define _PLUGIN_CLIENT_BASE_H_ 2 #define _PLUGIN_CLIENT_BASE_H_
3 3
4 4
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 6
7 7
8 class CPluginClientFactory; 8 class CPluginClientFactory;
9 9
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 DWORD GetThreadId() const { return m_threadId; } 43 DWORD GetThreadId() const { return m_threadId; }
44 }; 44 };
45 45
46 46
47 class CPluginClientBase 47 class CPluginClientBase
48 { 48 {
49 friend class CPluginClientFactory; 49 friend class CPluginClientFactory;
50 50
51 private: 51 private:
52 52
53 #ifdef SUPPORT_WHITELIST
54 CComAutoCriticalSection m_criticalSectionWhitelist;
55 std::map<CString,bool> m_cacheWhitelistedUrls;
56 #endif
57
58 static std::vector<CPluginError> s_pluginErrors; 53 static std::vector<CPluginError> s_pluginErrors;
59 54
60 static bool s_isErrorLogging; 55 static bool s_isErrorLogging;
61 56
62 protected: 57 protected:
63 58
64 // Protected constructor used by the singleton pattern 59 // Protected constructor used by the singleton pattern
65 CPluginClientBase(); 60 CPluginClientBase();
66 61
67 static CComAutoCriticalSection s_criticalSectionLocal; 62 static CComAutoCriticalSection s_criticalSectionLocal;
68 63
69 public: 64 public:
70 65
71 ~CPluginClientBase(); 66 ~CPluginClientBase();
72 67
73 static void SetLocalization(); 68 static void SetLocalization();
74 69
75 #ifdef SUPPORT_WHITELIST 70 #ifdef SUPPORT_WHITELIST
76 void CacheWhiteListedUrl(const CString& url, bool isWhitelisted);
77 bool IsUrlWhiteListed(const CString& url); 71 bool IsUrlWhiteListed(const CString& url);
78 void ClearWhiteListCache();
79 #endif // SUPPORT_WHITELIST 72 #endif // SUPPORT_WHITELIST
80 73
81 static bool IsValidDomain(const CString& domain); 74 static bool IsValidDomain(const CString& domain);
82 static CString ExtractDomain(const CString& url); 75 static CString ExtractDomain(const CString& url);
83 static CString& UnescapeUrl(CString& url); 76 static CString& UnescapeUrl(CString& url);
84 77
85 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const CString& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwThrea dId=0); 78 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const CString& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwThrea dId=0);
86 79
87 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons t CString& errorDescription); 80 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons t CString& errorDescription);
88 static bool PopFirstPluginError(CPluginError& pluginError); 81 static bool PopFirstPluginError(CPluginError& pluginError);
89 }; 82 };
90 83
91 84
92 #endif // _PLUGIN_CLIENT_BASE_H_ 85 #endif // _PLUGIN_CLIENT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld