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

Side by Side Diff: Shared/PluginSettings.h

Issue 9998007: Initial libadblockplus integration (Closed)
Patch Set: Subscription changes and filter management cleanup Created April 5, 2013, 1:56 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 | « Shared/PluginFilter.cpp ('k') | Shared/PluginSettings.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 /** 1 /**
2 * This class contains all client functionality of the IE plugin 2 * This class contains all client functionality of the IE plugin
3 * 3 *
4 * Exception errors are tested by calls to ExceptionsTest from: Main ... 4 * Exception errors are tested by calls to ExceptionsTest from: Main ...
5 */ 5 */
6 6
7 #ifndef _PLUGIN_SETTINGS_H_ 7 #ifndef _PLUGIN_SETTINGS_H_
8 #define _PLUGIN_SETTINGS_H_ 8 #define _PLUGIN_SETTINGS_H_
9 9
10 10
11 #include "PluginTypedef.h" 11 #include "PluginTypedef.h"
12 12
13 13
14 // Main settings 14 // Main settings
15 15
16 #define SETTING_PLUGIN_INFO_PANEL L"plugininfopanel" 16 #define SETTING_PLUGIN_INFO_PANEL L"plugininfopanel"
17 #define SETTING_PLUGIN_VERSION L"pluginversion" 17 #define SETTING_PLUGIN_VERSION L"pluginversion"
18 #define SETTING_PLUGIN_UPDATE_URL L"pluginupdateurl" 18 #define SETTING_PLUGIN_UPDATE_URL L"pluginupdateurl"
19 #define SETTING_PLUGIN_UPDATE_VERSION L"pluginupdateversion" 19 #define SETTING_PLUGIN_UPDATE_VERSION L"pluginupdateversion"
20 #define SETTING_PLUGIN_UPDATE_TIME L"pluginupdatetime" 20 #define SETTING_PLUGIN_UPDATE_TIME L"pluginupdatetime"
21 #define SETTING_PLUGIN_SELFTEST L"pluginselftest" 21 #define SETTING_PLUGIN_SELFTEST L"pluginselftest"
22 #define SETTING_LANGUAGE L"language" 22 #define SETTING_LANGUAGE L"language"
23 23
24 #ifdef SUPPORT_FILTER
25 #define SETTING_FILTER_VERSION L"filterversion"
26 #endif
27 #ifdef SUPPORT_CONFIG 24 #ifdef SUPPORT_CONFIG
28 #define SETTING_CONFIG_VERSION L"configversion" 25 #define SETTING_CONFIG_VERSION L"configversion"
29 #endif 26 #endif
30 #define SETTING_LAST_UPDATE_TIME L"lastupdatetime" 27 #define SETTING_LAST_UPDATE_TIME L"lastupdatetime"
31 #define SETTING_DICTIONARY_VERSION L"dictionaryversion" 28 #define SETTING_DICTIONARY_VERSION L"dictionaryversion"
32 29
33 // Tab settings 30 // Tab settings
34 31
35 #define SETTING_TAB_PLUGIN_ENABLED L"pluginenabled" 32 #define SETTING_TAB_PLUGIN_ENABLED L"pluginenabled"
36 #define SETTING_TAB_COUNT L"tabcount" 33 #define SETTING_TAB_COUNT L"tabcount"
37 #define SETTING_TAB_START_TIME L"tabstart" 34 #define SETTING_TAB_START_TIME L"tabstart"
38 #define SETTING_TAB_UPDATE_ON_START L"updateonstart" 35 #define SETTING_TAB_UPDATE_ON_START L"updateonstart"
39 #define SETTING_TAB_UPDATE_ON_START_REMOVE L"updateonstartremove" 36 #define SETTING_TAB_UPDATE_ON_START_REMOVE L"updateonstartremove"
40 #define SETTING_TAB_DICTIONARY_VERSION L"dictionaryversion" 37 #define SETTING_TAB_DICTIONARY_VERSION L"dictionaryversion"
41 #define SETTING_TAB_SETTINGS_VERSION L"settingsversion" 38 #define SETTING_TAB_SETTINGS_VERSION L"settingsversion"
42 #ifdef SUPPORT_FILTER 39 #ifdef SUPPORT_FILTER
43 #define SETTING_TAB_FILTER_VERSION L"filterversion" 40 #define SETTING_TAB_FILTER_VERSION L"filterversion"
44 #endif 41 #endif
42
45 #ifdef SUPPORT_WHITELIST 43 #ifdef SUPPORT_WHITELIST
46 #define SETTING_TAB_WHITELIST_VERSION L"whitelistversion" 44 #define SETTING_TAB_WHITELIST_VERSION L"whitelistversion"
47 #endif 45 #endif
48 #ifdef SUPPORT_CONFIG 46 #ifdef SUPPORT_CONFIG
49 #define SETTING_TAB_CONFIG_VERSION L"configversion" 47 #define SETTING_TAB_CONFIG_VERSION L"configversion"
50 #endif 48 #endif
51 49
52 50
53 class CPluginIniFileW; 51 class CPluginIniFileW;
54 52
(...skipping 19 matching lines...) Expand all
74 72
75 #ifdef SUPPORT_WHITELIST 73 #ifdef SUPPORT_WHITELIST
76 TDomainList m_domainList; 74 TDomainList m_domainList;
77 TDomainHistory m_domainHistory; 75 TDomainHistory m_domainHistory;
78 #endif 76 #endif
79 77
80 CPluginSettings::TProperties m_properties; 78 CPluginSettings::TProperties m_properties;
81 79
82 bool m_isDirty; 80 bool m_isDirty;
83 81
84 #ifdef SUPPORT_FILTER
85 CPluginSettings::TFilterUrlList m_filterUrlList;
86 std::map<CString, CString> m_filterFileNameList;
87 std::map<CString, CString> m_filterLanguagesList;
88 std::map<CString, CString> m_filterLanguageTitleList; // Key - language, Value - language title
89 std::map<CString, time_t> m_filterDownloadTimesList;
90 #endif
91
92 CString m_settingsVersion; 82 CString m_settingsVersion;
93 std::auto_ptr<CPluginIniFileW> m_settingsFile; 83 std::auto_ptr<CPluginIniFileW> m_settingsFile;
94 84
95 static WCHAR* s_dataPath; 85 static WCHAR* s_dataPath;
96 static WCHAR* s_dataPathParent; 86 static WCHAR* s_dataPathParent;
97 87
98 88
99 static CComAutoCriticalSection s_criticalSectionLocal; 89 static CComAutoCriticalSection s_criticalSectionLocal;
100 #ifdef SUPPORT_FILTER
101 static CComAutoCriticalSection s_criticalSectionFilters;
102 #endif
103 #ifdef SUPPORT_WHITELIST 90 #ifdef SUPPORT_WHITELIST
104 static CComAutoCriticalSection s_criticalSectionDomainHistory; 91 static CComAutoCriticalSection s_criticalSectionDomainHistory;
105 #endif 92 #endif
106 93
107 bool m_isPluginSelftestEnabled; 94 bool m_isPluginSelftestEnabled;
108 95
109 void Clear(); 96 void Clear();
110 97
111 // Private constructor used by the singleton pattern 98 // Private constructor used by the singleton pattern
112 CPluginSettings(); 99 CPluginSettings();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 135
149 bool IsPluginEnabled() const; 136 bool IsPluginEnabled() const;
150 bool IsPluginUpdateAvailable() const; 137 bool IsPluginUpdateAvailable() const;
151 138
152 bool IsPluginSelftestEnabled(); 139 bool IsPluginSelftestEnabled();
153 140
154 bool FilterlistExpired(CString filterlist) const; 141 bool FilterlistExpired(CString filterlist) const;
155 bool FilterShouldLoad(CString filterlist) const; 142 bool FilterShouldLoad(CString filterlist) const;
156 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime); 143 bool SetFilterRefreshDate(CString filterlist, time_t refreshtime);
157 144
158 #ifdef SUPPORT_FILTER
159
160 void SetFilterUrlList(const TFilterUrlList& filters);
161 void SetFilterFileNamesList(const std::map<CString, CString>& filters);
162 TFilterUrlList GetFilterUrlList() const;
163 std::map<CString, CString> GetFilterFileNamesList() const;
164 std::map<CString, CString> GetFilterLanguageTitleList() const; 145 std::map<CString, CString> GetFilterLanguageTitleList() const;
165 146
166 void AddFilterUrl(const CString& url, int version);
167 void AddFilterFileName(const CString& url, const CString& fileName);
168 #endif // SUPPORT_FILTER
169
170 #ifdef SUPPORT_WHITELIST 147 #ifdef SUPPORT_WHITELIST
171 148
172 void AddDomainToHistory(const CString& domain); 149 void AddDomainToHistory(const CString& domain);
173 TDomainHistory GetDomainHistory() const; 150 TDomainHistory GetDomainHistory() const;
174 151
175 #endif // SUPPORT_WHITELIST 152 #endif // SUPPORT_WHITELIST
176 153
177 void SetMainProcessId(); 154 void SetMainProcessId();
178 void SetMainProcessId(DWORD id); 155 void SetMainProcessId(DWORD id);
179 bool IsMainProcess(DWORD dwProcessId=0) const; 156 bool IsMainProcess(DWORD dwProcessId=0) const;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 239
263 public: 240 public:
264 241
265 void AddWhiteListedDomain(const CString& domain, int reason=1, bool isToGo=fal se); 242 void AddWhiteListedDomain(const CString& domain, int reason=1, bool isToGo=fal se);
266 void RemoveWhiteListedDomainsToGo(const TDomainList& domains); 243 void RemoveWhiteListedDomainsToGo(const TDomainList& domains);
267 void ReplaceWhiteListedDomains(const TDomainList& domains); 244 void ReplaceWhiteListedDomains(const TDomainList& domains);
268 bool IsWhiteListedDomain(const CString& domain) const; 245 bool IsWhiteListedDomain(const CString& domain) const;
269 int GetWhiteListedDomainCount() const; 246 int GetWhiteListedDomainCount() const;
270 TDomainList GetWhiteListedDomainList(bool isToGo=false) const; 247 TDomainList GetWhiteListedDomainList(bool isToGo=false) const;
271 248
272 bool CheckFilterAndDownload();
273 bool MakeRequestForUpdate(); 249 bool MakeRequestForUpdate();
274 bool RefreshWhitelist(); 250 bool RefreshWhitelist();
275 DWORD GetWindowsBuildNumber(); 251 DWORD GetWindowsBuildNumber();
276 252
253 void SetSubscription(BSTR language);
254 void SetSubscription(std::string language);
255 void RefreshFilterlist();
256
257
277 #endif //SUPPORT_WHITELIST 258 #endif //SUPPORT_WHITELIST
278 259
279 }; 260 };
280 261
281 262
282 #endif // _PLUGIN_SETTINGS_H_ 263 #endif // _PLUGIN_SETTINGS_H_
OLDNEW
« no previous file with comments | « Shared/PluginFilter.cpp ('k') | Shared/PluginSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld