OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
5 #include "PluginSystem.h" | 5 #include "PluginSystem.h" |
6 #ifdef SUPPORT_FILTER | 6 #ifdef SUPPORT_FILTER |
7 #include "PluginFilter.h" | 7 #include "PluginFilter.h" |
8 #endif | 8 #endif |
9 #include "PluginMimeFilterClient.h" | 9 #include "PluginMimeFilterClient.h" |
10 #include "PluginClient.h" | 10 #include "PluginClient.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 //register the mimefilter | 255 //register the mimefilter |
256 //and only mimefilter | 256 //and only mimefilter |
257 //on some few computers the mimefilter does not get properly registered when
it is done on another thread | 257 //on some few computers the mimefilter does not get properly registered when
it is done on another thread |
258 | 258 |
259 s_criticalSectionLocal.Lock(); | 259 s_criticalSectionLocal.Lock(); |
260 { | 260 { |
261 // Always register on startup, then check if we need to unregister in a se
parate thread | 261 // Always register on startup, then check if we need to unregister in a se
parate thread |
262 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 262 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
263 s_asyncWebBrowser2 = unknownSite; | 263 s_asyncWebBrowser2 = unknownSite; |
264 s_instances.insert( this ); | 264 s_instances.insert(this); |
265 } | 265 } |
266 s_criticalSectionLocal.Unlock(); | 266 s_criticalSectionLocal.Unlock(); |
267 | 267 |
268 try | 268 try |
269 { | 269 { |
270 // Check if loaded as BHO | 270 // Check if loaded as BHO |
271 if (GetBrowser()) | 271 if (GetBrowser()) |
272 { | 272 { |
273 DEBUG_GENERAL("Loaded as BHO"); | 273 DEBUG_GENERAL("Loaded as BHO"); |
274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); | 274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 s_criticalSectionLocal.Lock(); | 366 s_criticalSectionLocal.Lock(); |
367 { | 367 { |
368 s_instances.erase(this); | 368 s_instances.erase(this); |
369 | 369 |
370 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC
urrentThreadId()); | 370 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC
urrentThreadId()); |
371 if (it != s_threadInstances.end()) | 371 if (it != s_threadInstances.end()) |
372 { | 372 { |
373 s_threadInstances.erase(it); | 373 s_threadInstances.erase(it); |
374 } | 374 } |
375 if ( s_instances.empty() ) | 375 if (s_instances.empty()) |
376 { | 376 { |
377 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 377 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
378 } | 378 } |
379 } | 379 } |
380 s_criticalSectionLocal.Unlock(); | 380 s_criticalSectionLocal.Unlock(); |
381 | 381 |
382 // Release browser interface | 382 // Release browser interface |
383 s_criticalSectionBrowser.Lock(); | 383 s_criticalSectionBrowser.Lock(); |
384 { | 384 { |
385 m_webBrowser2.Release(); | 385 m_webBrowser2.Release(); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 if (hTabWnd2) | 886 if (hTabWnd2) |
887 { | 887 { |
888 DWORD nProcessId; | 888 DWORD nProcessId; |
889 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); | 889 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); |
890 if (::GetCurrentProcessId() == nProcessId) | 890 if (::GetCurrentProcessId() == nProcessId) |
891 { | 891 { |
892 bool bExistingTab = false; | 892 bool bExistingTab = false; |
893 | 893 |
894 s_criticalSectionLocal.Lock(); | 894 s_criticalSectionLocal.Lock(); |
895 { | 895 { |
896 for ( auto instance : s_instances ) | 896 for (auto instance : s_instances) |
897 { | 897 { |
898 if ( instance->m_hTabWnd == hTabWnd2) | 898 if (instance->m_hTabWnd == hTabWnd2) |
899 { | 899 { |
900 | |
901 bExistingTab = true; | 900 bExistingTab = true; |
902 break; | 901 break; |
903 } | 902 } |
904 } | 903 } |
905 } | 904 } |
906 s_criticalSectionLocal.Unlock(); | 905 s_criticalSectionLocal.Unlock(); |
907 | 906 |
908 if (!bExistingTab) | 907 if (!bExistingTab) |
909 { | 908 { |
910 amoundOfNewTabs ++; | 909 amoundOfNewTabs ++; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 m_hTheme = pfnOpenThemeData(m_hPaneWnd, L"STATUS"); | 1054 m_hTheme = pfnOpenThemeData(m_hPaneWnd, L"STATUS"); |
1056 if (!m_hTheme) | 1055 if (!m_hTheme) |
1057 { | 1056 { |
1058 } | 1057 } |
1059 } | 1058 } |
1060 } | 1059 } |
1061 | 1060 |
1062 | 1061 |
1063 CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd) | 1062 CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd) |
1064 { | 1063 { |
1065 CPluginClass* return_instance = NULL; | 1064 CPluginClass* return_instance = nullptr; |
1066 | 1065 |
1067 s_criticalSectionLocal.Lock(); | 1066 s_criticalSectionLocal.Lock(); |
1068 { | 1067 { |
1069 for ( auto instance : s_instances ) | 1068 for (auto instance : s_instances) |
1070 { | 1069 { |
1071 if ( instance->m_hStatusBarWnd == hStatusBarWnd) | 1070 if (instance->m_hStatusBarWnd == hStatusBarWnd) |
1072 { | 1071 { |
1073 return_instance = instance; | 1072 return_instance = instance; |
1074 break; | 1073 break; |
1075 } | 1074 } |
1076 } | 1075 } |
1077 } | 1076 } |
1078 s_criticalSectionLocal.Unlock(); | 1077 s_criticalSectionLocal.Unlock(); |
1079 | 1078 |
1080 return return_instance; | 1079 return return_instance; |
1081 } | 1080 } |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 if (hTabWnd2) | 1941 if (hTabWnd2) |
1943 { | 1942 { |
1944 DWORD nProcessId; | 1943 DWORD nProcessId; |
1945 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); | 1944 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); |
1946 if (::GetCurrentProcessId() == nProcessId) | 1945 if (::GetCurrentProcessId() == nProcessId) |
1947 { | 1946 { |
1948 bool bExistingTab = false; | 1947 bool bExistingTab = false; |
1949 s_criticalSectionLocal.Lock(); | 1948 s_criticalSectionLocal.Lock(); |
1950 | 1949 |
1951 { | 1950 { |
1952 for ( auto instance : s_instances ) | 1951 for (auto instance : s_instances) |
1953 { | 1952 { |
1954 if ( instance->m_hTabWnd == hTabWnd2 ) | 1953 if (instance->m_hTabWnd == hTabWnd2) |
1955 { | 1954 { |
1956 bExistingTab = true; | 1955 bExistingTab = true; |
1957 break; | 1956 break; |
1958 } | 1957 } |
1959 } | 1958 } |
1960 } | 1959 } |
1961 | 1960 |
1962 if (!bExistingTab) | 1961 if (!bExistingTab) |
1963 { | 1962 { |
1964 hBrowserWnd = hTabWnd2; | 1963 hBrowserWnd = hTabWnd2; |
1965 hTabWnd = hTabWnd2; | 1964 hTabWnd = hTabWnd2; |
1966 s_criticalSectionLocal.Unlock(); | 1965 s_criticalSectionLocal.Unlock(); |
1967 break; | 1966 break; |
1968 } | 1967 } |
1969 s_criticalSectionLocal.Unlock(); | 1968 s_criticalSectionLocal.Unlock(); |
1970 | 1969 |
1971 } | 1970 } |
1972 } | 1971 } |
1973 } | 1972 } |
1974 | 1973 |
1975 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1974 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1976 } | 1975 } |
1977 | 1976 |
1978 return hTabWnd; | 1977 return hTabWnd; |
1979 | 1978 |
1980 } | 1979 } |
OLD | NEW |