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 26 matching lines...) Expand all Loading... |
37 CPluginSettingsWhitelistLock() : CPluginMutex(L"SettingsFileWhitelist", PLUGIN
_ERROR_MUTEX_SETTINGS_FILE_WHITELIST) {} | 37 CPluginSettingsWhitelistLock() : CPluginMutex(L"SettingsFileWhitelist", PLUGIN
_ERROR_MUTEX_SETTINGS_FILE_WHITELIST) {} |
38 ~CPluginSettingsWhitelistLock() {} | 38 ~CPluginSettingsWhitelistLock() {} |
39 }; | 39 }; |
40 | 40 |
41 CPluginSettings* CPluginSettings::s_instance = NULL; | 41 CPluginSettings* CPluginSettings::s_instance = NULL; |
42 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; | 42 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; |
43 | 43 |
44 CPluginSettings::CPluginSettings() : m_dwWorkingThreadId(0) | 44 CPluginSettings::CPluginSettings() : m_dwWorkingThreadId(0) |
45 { | 45 { |
46 s_instance = NULL; | 46 s_instance = NULL; |
47 m_WindowsBuildNumber = 0; | |
48 ClearWhitelist(); | 47 ClearWhitelist(); |
49 } | 48 } |
50 | 49 |
51 CPluginSettings::~CPluginSettings() | 50 CPluginSettings::~CPluginSettings() |
52 { | 51 { |
53 s_instance = NULL; | 52 s_instance = NULL; |
54 } | 53 } |
55 | 54 |
56 CPluginSettings* CPluginSettings::GetInstance() | 55 CPluginSettings* CPluginSettings::GetInstance() |
57 { | 56 { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 { | 219 { |
221 CPluginSettingsWhitelistLock lock; | 220 CPluginSettingsWhitelistLock lock; |
222 if (lock.IsLocked()) | 221 if (lock.IsLocked()) |
223 { | 222 { |
224 ReadWhitelist(true); | 223 ReadWhitelist(true); |
225 } | 224 } |
226 | 225 |
227 return true; | 226 return true; |
228 } | 227 } |
229 | 228 |
230 DWORD CPluginSettings::GetWindowsBuildNumber() | |
231 { | |
232 if (m_WindowsBuildNumber == 0) | |
233 { | |
234 OSVERSIONINFOEX osvi = {}; | |
235 osvi.dwOSVersionInfoSize = sizeof(osvi); | |
236 if (GetVersionExW(reinterpret_cast<OSVERSIONINFO*>(&osvi)) != 0) | |
237 { | |
238 m_WindowsBuildNumber = osvi.dwBuildNumber; | |
239 } | |
240 } | |
241 | |
242 return m_WindowsBuildNumber; | |
243 } | |
244 | |
245 void CPluginSettings::SetSubscription(const std::wstring& url) | 229 void CPluginSettings::SetSubscription(const std::wstring& url) |
246 { | 230 { |
247 CPluginClient::GetInstance()->SetSubscription(url); | 231 CPluginClient::GetInstance()->SetSubscription(url); |
248 RefreshWhitelist(); | 232 RefreshWhitelist(); |
249 } | 233 } |
250 | 234 |
251 CString CPluginSettings::GetSubscription() | 235 CString CPluginSettings::GetSubscription() |
252 { | 236 { |
253 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc
e()->GetListedSubscriptions(); | 237 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc
e()->GetListedSubscriptions(); |
254 std::wstring aaUrl = CPluginClient::GetInstance()->GetPref(L"subscriptions_exc
eptionsurl", L""); | 238 std::wstring aaUrl = CPluginClient::GetInstance()->GetPref(L"subscriptions_exc
eptionsurl", L""); |
(...skipping 10 matching lines...) Expand all Loading... |
265 | 249 |
266 CString CPluginSettings::GetAppLocale() | 250 CString CPluginSettings::GetAppLocale() |
267 { | 251 { |
268 return ToCString(GetBrowserLanguage()); | 252 return ToCString(GetBrowserLanguage()); |
269 } | 253 } |
270 | 254 |
271 CString CPluginSettings::GetDocumentationLink() | 255 CString CPluginSettings::GetDocumentationLink() |
272 { | 256 { |
273 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); | 257 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); |
274 } | 258 } |
OLD | NEW |