| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
| 19 | 19 |
| 20 #include "PluginClass.h" | 20 #include "PluginClass.h" |
| 21 #include "PluginSettings.h" | 21 #include "PluginSettings.h" |
| 22 #include "PluginSystem.h" | 22 #include "PluginSystem.h" |
| 23 #include "PluginFilter.h" | 23 #include "PluginFilter.h" |
| 24 #include "PluginMimeFilterClient.h" | 24 #include "PluginAppNamespaceClient.h" |
| 25 #include "PluginClient.h" | 25 #include "PluginClient.h" |
| 26 #include "PluginMutex.h" | 26 #include "PluginMutex.h" |
| 27 #include "sddl.h" | 27 #include "sddl.h" |
| 28 #include "PluginUtil.h" | 28 #include "PluginUtil.h" |
| 29 #include "PluginUserSettings.h" | 29 #include "PluginUserSettings.h" |
| 30 #include "../shared/Utils.h" | 30 #include "../shared/Utils.h" |
| 31 #include "../shared/Dictionary.h" | 31 #include "../shared/Dictionary.h" |
| 32 #include "../shared/IE_version.h" | 32 #include "../shared/IE_version.h" |
| 33 #include <thread> | 33 #include <thread> |
| 34 #include <array> | 34 #include <array> |
| 35 | 35 |
| 36 #ifdef DEBUG_HIDE_EL | 36 #ifdef DEBUG_HIDE_EL |
| 37 DWORD profileTime = 0; | 37 DWORD profileTime = 0; |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 40 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
| 41 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); | 41 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); |
| 42 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 42 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
| 43 | 43 |
| 44 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 44 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
| 45 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL
ED, IDI_ICON_DEACTIVATED }; | 45 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL
ED, IDI_ICON_DEACTIVATED }; |
| 46 uint32_t iconHeight = 32; | 46 uint32_t iconHeight = 32; |
| 47 uint32_t iconWidth = 32; | 47 uint32_t iconWidth = 32; |
| 48 | 48 |
| 49 std::shared_ptr<CPluginMimeFilterClient> CPluginClass::s_mimeFilter = NULL; | 49 std::shared_ptr<CPluginAppNamespaceClient> CPluginClass::s_mimeFilter = NULL; |
| 50 | 50 |
| 51 CLOSETHEMEDATA pfnClose = NULL; | 51 CLOSETHEMEDATA pfnClose = NULL; |
| 52 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; | 52 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; |
| 53 OPENTHEMEDATA pfnOpenThemeData = NULL; | 53 OPENTHEMEDATA pfnOpenThemeData = NULL; |
| 54 | 54 |
| 55 ATOM CPluginClass::s_atomPaneClass = NULL; | 55 ATOM CPluginClass::s_atomPaneClass = NULL; |
| 56 HINSTANCE CPluginClass::s_hUxtheme = NULL; | 56 HINSTANCE CPluginClass::s_hUxtheme = NULL; |
| 57 std::set<CPluginClass*> CPluginClass::s_instances; | 57 std::set<CPluginClass*> CPluginClass::s_instances; |
| 58 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; | 58 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; |
| 59 | 59 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 //register the mimefilter | 242 //register the mimefilter |
| 243 //and only mimefilter | 243 //and only mimefilter |
| 244 //on some few computers the mimefilter does not get properly registered wh
en it is done on another thread | 244 //on some few computers the mimefilter does not get properly registered wh
en it is done on another thread |
| 245 | 245 |
| 246 s_criticalSectionLocal.Lock(); | 246 s_criticalSectionLocal.Lock(); |
| 247 { | 247 { |
| 248 // Always register on startup, then check if we need to unregister in a
separate thread | 248 // Always register on startup, then check if we need to unregister in a
separate thread |
| 249 if (!s_mimeFilter) | 249 if (!s_mimeFilter) |
| 250 { | 250 { |
| 251 s_mimeFilter.reset(new CPluginMimeFilterClient()); | 251 s_mimeFilter.reset(new CPluginAppNamespaceClient()); |
| 252 } | 252 } |
| 253 s_asyncWebBrowser2 = unknownSite; | 253 s_asyncWebBrowser2 = unknownSite; |
| 254 s_instances.insert(this); | 254 s_instances.insert(this); |
| 255 } | 255 } |
| 256 s_criticalSectionLocal.Unlock(); | 256 s_criticalSectionLocal.Unlock(); |
| 257 | 257 |
| 258 try | 258 try |
| 259 { | 259 { |
| 260 auto webBrowser = GetBrowser(); | 260 auto webBrowser = GetBrowser(); |
| 261 if (webBrowser) | 261 if (webBrowser) |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 { | 1076 { |
| 1077 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1077 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1078 | 1078 |
| 1079 settings->TogglePluginEnabled(); | 1079 settings->TogglePluginEnabled(); |
| 1080 | 1080 |
| 1081 // Enable / disable mime filter | 1081 // Enable / disable mime filter |
| 1082 s_criticalSectionLocal.Lock(); | 1082 s_criticalSectionLocal.Lock(); |
| 1083 { | 1083 { |
| 1084 if (settings->GetPluginEnabled()) | 1084 if (settings->GetPluginEnabled()) |
| 1085 { | 1085 { |
| 1086 s_mimeFilter.reset(new CPluginMimeFilterClient()); | 1086 s_mimeFilter.reset(new CPluginAppNamespaceClient()); |
| 1087 } | 1087 } |
| 1088 else | 1088 else |
| 1089 { | 1089 { |
| 1090 s_mimeFilter.reset(); | 1090 s_mimeFilter.reset(); |
| 1091 } | 1091 } |
| 1092 } | 1092 } |
| 1093 s_criticalSectionLocal.Unlock(); | 1093 s_criticalSectionLocal.Unlock(); |
| 1094 } | 1094 } |
| 1095 break; | 1095 break; |
| 1096 case ID_MENU_SETTINGS: | 1096 case ID_MENU_SETTINGS: |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 s_criticalSectionLocal.Unlock(); | 1728 s_criticalSectionLocal.Unlock(); |
| 1729 | 1729 |
| 1730 } | 1730 } |
| 1731 } | 1731 } |
| 1732 } | 1732 } |
| 1733 | 1733 |
| 1734 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1734 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 1735 } | 1735 } |
| 1736 return hTabWnd; | 1736 return hTabWnd; |
| 1737 } | 1737 } |
| OLD | NEW |