Left: | ||
Right: |
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 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); | 42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); |
43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
44 | 44 |
45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; | 46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; |
47 uint32_t iconHeight = 32; | 47 uint32_t iconHeight = 32; |
48 uint32_t iconWidth = 32; | 48 uint32_t iconWidth = 32; |
49 | 49 |
50 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; | |
51 | |
52 CLOSETHEMEDATA pfnClose = NULL; | 50 CLOSETHEMEDATA pfnClose = NULL; |
53 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; | 51 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; |
54 OPENTHEMEDATA pfnOpenThemeData = NULL; | 52 OPENTHEMEDATA pfnOpenThemeData = NULL; |
55 | 53 |
56 ATOM CPluginClass::s_atomPaneClass = NULL; | 54 ATOM CPluginClass::s_atomPaneClass = NULL; |
57 HINSTANCE CPluginClass::s_hUxtheme = NULL; | 55 HINSTANCE CPluginClass::s_hUxtheme = NULL; |
58 std::set<CPluginClass*> CPluginClass::s_instances; | 56 std::set<CPluginClass*> CPluginClass::s_instances; |
59 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; | 57 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; |
60 | 58 |
61 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; | 59 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 } | 235 } |
238 s_criticalSectionBrowser.Unlock(); | 236 s_criticalSectionBrowser.Unlock(); |
239 | 237 |
240 //register the mimefilter | 238 //register the mimefilter |
241 //and only mimefilter | 239 //and only mimefilter |
242 //on some few computers the mimefilter does not get properly registered when it is done on another thread | 240 //on some few computers the mimefilter does not get properly registered when it is done on another thread |
243 | 241 |
244 s_criticalSectionLocal.Lock(); | 242 s_criticalSectionLocal.Lock(); |
245 { | 243 { |
246 // Always register on startup, then check if we need to unregister in a se parate thread | 244 // Always register on startup, then check if we need to unregister in a se parate thread |
247 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 245 CPluginClientFactory::GetMimeFilterClientInstance(); |
248 s_asyncWebBrowser2 = unknownSite; | 246 s_asyncWebBrowser2 = unknownSite; |
249 s_instances.insert(this); | 247 s_instances.insert(this); |
250 } | 248 } |
251 s_criticalSectionLocal.Unlock(); | 249 s_criticalSectionLocal.Unlock(); |
252 | 250 |
253 try | 251 try |
254 { | 252 { |
255 // Check if loaded as BHO | 253 // Check if loaded as BHO |
256 auto webBrowser = GetBrowser(); | 254 auto webBrowser = GetBrowser(); |
257 if (webBrowser) | 255 if (webBrowser) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 { | 502 { |
505 return; | 503 return; |
506 } | 504 } |
507 if (!urlVariant || urlVariant->vt != VT_BSTR) | 505 if (!urlVariant || urlVariant->vt != VT_BSTR) |
508 { | 506 { |
509 return; | 507 return; |
510 } | 508 } |
511 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal)); | 509 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal)); |
512 UnescapeUrl(url); | 510 UnescapeUrl(url); |
513 | 511 |
514 //Register a mime filter if it's not registered yet | |
Eric
2015/03/27 13:35:50
I'm assuming there was a reason to have this state
sergei
2015/04/01 18:49:32
It was indeed the issue here. We disable the plugi
| |
515 if (s_mimeFilter == nullptr) | |
516 { | |
517 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | |
518 } | |
519 // If webbrowser2 is equal to top level browser (as set in SetSite), we are | 512 // If webbrowser2 is equal to top level browser (as set in SetSite), we are |
520 // navigating new page | 513 // navigating new page |
521 CPluginClient* client = CPluginClient::GetInstance(); | 514 CPluginClient* client = CPluginClient::GetInstance(); |
522 if (url.find(L"javascript") == 0) | 515 if (url.find(L"javascript") == 0) |
523 { | 516 { |
524 } | 517 } |
525 else if (GetBrowser().IsEqualObject(webBrowser)) | 518 else if (GetBrowser().IsEqualObject(webBrowser)) |
526 { | 519 { |
527 m_tab->OnNavigate(url); | 520 m_tab->OnNavigate(url); |
528 DEBUG_GENERAL( | 521 DEBUG_GENERAL( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 } | 647 } |
655 } | 648 } |
656 | 649 |
657 bool CPluginClass::InitObject(bool bBHO) | 650 bool CPluginClass::InitObject(bool bBHO) |
658 { | 651 { |
659 DEBUG_GENERAL("InitObject"); | 652 DEBUG_GENERAL("InitObject"); |
660 CPluginSettings* settings = CPluginSettings::GetInstance(); | 653 CPluginSettings* settings = CPluginSettings::GetInstance(); |
661 | 654 |
662 if (!settings->GetPluginEnabled()) | 655 if (!settings->GetPluginEnabled()) |
663 { | 656 { |
664 s_mimeFilter->Unregister(); | 657 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
Oleksandr
2015/03/27 08:02:29
This fixes the issue. Just calling Unregister() he
sergei
2015/04/01 18:49:32
No, it does not mean that our APP handlers remain
| |
665 } | 658 } |
666 | 659 |
667 // Load theme module | 660 // Load theme module |
668 s_criticalSectionLocal.Lock(); | 661 s_criticalSectionLocal.Lock(); |
669 { | 662 { |
670 if (!s_hUxtheme) | 663 if (!s_hUxtheme) |
671 { | 664 { |
672 s_hUxtheme = ::GetModuleHandle(L"uxtheme.dll"); | 665 s_hUxtheme = ::GetModuleHandle(L"uxtheme.dll"); |
673 if (s_hUxtheme) | 666 if (s_hUxtheme) |
674 { | 667 { |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 { | 1106 { |
1114 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1107 CPluginSettings* settings = CPluginSettings::GetInstance(); |
1115 | 1108 |
1116 settings->TogglePluginEnabled(); | 1109 settings->TogglePluginEnabled(); |
1117 | 1110 |
1118 // Enable / disable mime filter | 1111 // Enable / disable mime filter |
1119 s_criticalSectionLocal.Lock(); | 1112 s_criticalSectionLocal.Lock(); |
1120 { | 1113 { |
1121 if (settings->GetPluginEnabled()) | 1114 if (settings->GetPluginEnabled()) |
1122 { | 1115 { |
1123 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 1116 CPluginClientFactory::GetMimeFilterClientInstance(); |
1124 } | 1117 } |
1125 else | 1118 else |
1126 { | 1119 { |
1127 s_mimeFilter = NULL; | |
1128 | |
1129 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 1120 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
1130 } | 1121 } |
1131 } | 1122 } |
1132 s_criticalSectionLocal.Unlock(); | 1123 s_criticalSectionLocal.Unlock(); |
1133 } | 1124 } |
1134 break; | 1125 break; |
1135 case ID_MENU_SETTINGS: | 1126 case ID_MENU_SETTINGS: |
1136 { | 1127 { |
1137 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 1128 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
1138 if (browser) | 1129 if (browser) |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1766 s_criticalSectionLocal.Unlock(); | 1757 s_criticalSectionLocal.Unlock(); |
1767 | 1758 |
1768 } | 1759 } |
1769 } | 1760 } |
1770 } | 1761 } |
1771 | 1762 |
1772 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1763 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1773 } | 1764 } |
1774 return hTabWnd; | 1765 return hTabWnd; |
1775 } | 1766 } |
OLD | NEW |