OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #define SETTING_TAB_DICTIONARY_VERSION L"dictionaryversion" | 45 #define SETTING_TAB_DICTIONARY_VERSION L"dictionaryversion" |
46 #define SETTING_TAB_SETTINGS_VERSION L"settingsversion" | 46 #define SETTING_TAB_SETTINGS_VERSION L"settingsversion" |
47 #define SETTING_TAB_FILTER_VERSION L"filterversion" | 47 #define SETTING_TAB_FILTER_VERSION L"filterversion" |
48 #define SETTING_TAB_WHITELIST_VERSION L"whitelistversion" | 48 #define SETTING_TAB_WHITELIST_VERSION L"whitelistversion" |
49 | 49 |
50 class CPluginIniFileW; | 50 class CPluginIniFileW; |
51 | 51 |
52 class CPluginSettings | 52 class CPluginSettings |
53 { | 53 { |
54 private: | 54 private: |
55 DWORD m_dwWorkingThreadId; | |
56 | |
57 static CComAutoCriticalSection s_criticalSectionLocal; | 55 static CComAutoCriticalSection s_criticalSectionLocal; |
58 | 56 |
59 void Clear(); | 57 void Clear(); |
60 | 58 |
61 // Private constructor used by the singleton pattern | 59 // Private constructor used by the singleton pattern |
62 CPluginSettings(); | 60 CPluginSettings(); |
63 | 61 |
64 public: | 62 public: |
65 ~CPluginSettings(); | 63 ~CPluginSettings(); |
66 | 64 |
67 static CPluginSettings* s_instance; | 65 static CPluginSettings* s_instance; |
68 | 66 |
69 static bool HasInstance(); | 67 static bool HasInstance(); |
70 static CPluginSettings* GetInstance(); | 68 static CPluginSettings* GetInstance(); |
71 | 69 |
72 bool IsPluginEnabled() const; | 70 bool IsPluginEnabled() const; |
73 | 71 |
74 std::map<std::wstring, std::wstring> GetFilterLanguageTitleList() const; | 72 std::map<std::wstring, std::wstring> GetFilterLanguageTitleList() const; |
75 | 73 |
76 void SetWorkingThreadId(); | |
77 void SetWorkingThreadId(DWORD id); | |
78 bool IsWorkingThread(DWORD dwThread=0) const; | |
79 | |
80 public: | 74 public: |
81 | 75 |
82 void TogglePluginEnabled(); | 76 void TogglePluginEnabled(); |
83 bool GetPluginEnabled() const; | 77 bool GetPluginEnabled() const; |
84 | 78 |
85 void AddError(const CString& error, const CString& errorCode); | 79 void AddError(const CString& error, const CString& errorCode); |
86 | 80 |
87 // Settings whitelist | 81 // Settings whitelist |
88 private: | 82 private: |
89 std::vector<std::wstring> m_whitelistedDomains; | 83 std::vector<std::wstring> m_whitelistedDomains; |
90 void ClearWhitelist(); | 84 void ClearWhitelist(); |
91 bool ReadWhitelist(bool bDebug=true); | 85 bool ReadWhitelist(bool bDebug=true); |
92 | 86 |
93 public: | 87 public: |
94 void AddWhiteListedDomain(const std::wstring& domain); | 88 void AddWhiteListedDomain(const std::wstring& domain); |
95 void RemoveWhiteListedDomain(const std::wstring& domain); | 89 void RemoveWhiteListedDomain(const std::wstring& domain); |
96 int GetWhiteListedDomainCount() const; | 90 int GetWhiteListedDomainCount() const; |
97 std::vector<std::wstring> GetWhiteListedDomainList(); | 91 std::vector<std::wstring> GetWhiteListedDomainList(); |
98 | 92 |
99 bool RefreshWhitelist(); | 93 bool RefreshWhitelist(); |
100 | 94 |
101 void SetSubscription(const std::wstring& url); | 95 void SetSubscription(const std::wstring& url); |
102 std::wstring GetSubscription(); | 96 std::wstring GetSubscription(); |
103 }; | 97 }; |
104 | 98 |
105 std::wstring GetDataPath(const std::wstring& filename=L""); | |
106 | |
107 #endif // _PLUGIN_SETTINGS_H_ | 99 #endif // _PLUGIN_SETTINGS_H_ |
OLD | NEW |