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" |
11 #include "PluginClientFactory.h" | 11 #include "PluginClientFactory.h" |
12 #include "PluginMutex.h" | 12 #include "PluginMutex.h" |
13 #include "sddl.h" | 13 #include "sddl.h" |
14 #include "PluginUtil.h" | 14 #include "PluginUtil.h" |
15 #include "PluginUserSettings.h" | 15 #include "PluginUserSettings.h" |
16 | 16 #include "../shared/Utils.h" |
17 #include "../shared/Dictionary.h" | 17 #include "../shared/Dictionary.h" |
18 | 18 |
19 #ifdef DEBUG_HIDE_EL | 19 #ifdef DEBUG_HIDE_EL |
20 DWORD profileTime = 0; | 20 DWORD profileTime = 0; |
21 #endif | 21 #endif |
22 | 22 |
23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); | 24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR
ECT); |
25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
26 | 26 |
27 | |
28 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 27 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
29 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL
ED, IDI_ICON_DEACTIVATED }; | 28 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL
ED, IDI_ICON_DEACTIVATED }; |
30 | 29 |
31 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; | 30 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; |
32 | 31 |
33 CLOSETHEMEDATA pfnClose = NULL; | 32 CLOSETHEMEDATA pfnClose = NULL; |
34 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; | 33 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; |
35 OPENTHEMEDATA pfnOpenThemeData = NULL; | 34 OPENTHEMEDATA pfnOpenThemeData = NULL; |
36 | 35 |
37 ATOM CPluginClass::s_atomPaneClass = NULL; | 36 ATOM CPluginClass::s_atomPaneClass = NULL; |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 { | 587 { |
589 m_isInitializedOk = true; | 588 m_isInitializedOk = true; |
590 if (!InitObject(true)) | 589 if (!InitObject(true)) |
591 { | 590 { |
592 // Unadvice(); | 591 // Unadvice(); |
593 } | 592 } |
594 UpdateStatusBar(); | 593 UpdateStatusBar(); |
595 } | 594 } |
596 } | 595 } |
597 } | 596 } |
| 597 if (notificationMessage.IsVisible()) |
| 598 { |
| 599 notificationMessage.Hide(); |
| 600 } |
598 DEBUG_GENERAL("Tab change end"); | 601 DEBUG_GENERAL("Tab change end"); |
599 return VARIANT_TRUE; | 602 return VARIANT_TRUE; |
600 } | 603 } |
601 | 604 |
602 // This gets called whenever there's a browser event | 605 // This gets called whenever there's a browser event |
603 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W
ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo,
UINT* puArgErr) | 606 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W
ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo,
UINT* puArgErr) |
604 { | 607 { |
605 WCHAR tmp[256]; | 608 WCHAR tmp[256]; |
606 wsprintf(tmp, L"Invoke: %d\n", dispidMember); | 609 wsprintf(tmp, L"Invoke: %d\n", dispidMember); |
607 DEBUG_GENERAL(tmp); | 610 DEBUG_GENERAL(tmp); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0)
; | 1266 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0)
; |
1264 | 1267 |
1265 ::DestroyMenu(hMenu); | 1268 ::DestroyMenu(hMenu); |
1266 ::DestroyWindow(hMenuWnd); | 1269 ::DestroyWindow(hMenuWnd); |
1267 | 1270 |
1268 switch (nCommand) | 1271 switch (nCommand) |
1269 { | 1272 { |
1270 case ID_MENU_UPDATE: | 1273 case ID_MENU_UPDATE: |
1271 { | 1274 { |
1272 CPluginClient* client = CPluginClient::GetInstance(); | 1275 CPluginClient* client = CPluginClient::GetInstance(); |
1273 client->CheckForUpdates(); | 1276 notificationMessage.SetParent(m_hPaneWnd); |
| 1277 Dictionary* dictionary = Dictionary::GetInstance(); |
| 1278 std::wstring checkingText = dictionary->Lookup("updater", "checking-for-up
dates-text"); |
| 1279 std::wstring checkingTitle = dictionary->Lookup("updater", "checking-for-u
pdates-title"); |
| 1280 notificationMessage.Show(checkingText, checkingTitle, TTI_INFO); |
| 1281 client->CheckForUpdates(m_hPaneWnd); |
1274 } | 1282 } |
1275 break; | 1283 break; |
1276 case ID_MENU_DISABLE: | 1284 case ID_MENU_DISABLE: |
1277 { | 1285 { |
1278 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1286 CPluginSettings* settings = CPluginSettings::GetInstance(); |
1279 | 1287 |
1280 settings->TogglePluginEnabled(); | 1288 settings->TogglePluginEnabled(); |
1281 | 1289 |
1282 // Enable / disable mime filter | 1290 // Enable / disable mime filter |
1283 s_criticalSectionLocal.Lock(); | 1291 s_criticalSectionLocal.Lock(); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 break; | 1778 break; |
1771 case SC_CLOSE: | 1779 case SC_CLOSE: |
1772 break; | 1780 break; |
1773 | 1781 |
1774 case WM_UPDATEUISTATE: | 1782 case WM_UPDATEUISTATE: |
1775 { | 1783 { |
1776 CPluginTab* tab = GetTab(::GetCurrentThreadId()); | 1784 CPluginTab* tab = GetTab(::GetCurrentThreadId()); |
1777 if (tab) | 1785 if (tab) |
1778 { | 1786 { |
1779 tab->OnActivate(); | 1787 tab->OnActivate(); |
| 1788 RECT rect; |
| 1789 GetWindowRect(pClass->m_hPaneWnd, &rect); |
| 1790 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) /
2, rect.top + (rect.bottom - rect.top) / 2); |
| 1791 } |
| 1792 if (LOWORD(wParam) == UIS_CLEAR) |
| 1793 { |
| 1794 pClass->notificationMessage.Hide(); |
1780 } | 1795 } |
1781 } | 1796 } |
1782 break; | 1797 break; |
| 1798 case WM_WINDOWPOSCHANGING: |
| 1799 { |
| 1800 RECT rect; |
| 1801 GetWindowRect(pClass->m_hPaneWnd, &rect); |
| 1802 if (pClass->notificationMessage.IsVisible()) |
| 1803 { |
| 1804 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) /
2, rect.top + (rect.bottom - rect.top) / 2); |
| 1805 } |
| 1806 } |
| 1807 break; |
| 1808 case WM_ALREADY_UP_TO_DATE: |
| 1809 { |
| 1810 Dictionary* dictionary = Dictionary::GetInstance(); |
| 1811 std::wstring upToDateText = dictionary->Lookup("updater", "update-already-
up-to-date-text"); |
| 1812 std::wstring upToDateTitle = dictionary->Lookup("updater", "update-already
-up-to-date-title"); |
| 1813 pClass->notificationMessage.SetTextAndIcon(upToDateText, upToDateTitle, TT
I_INFO); |
| 1814 } |
| 1815 break; |
| 1816 case WM_UPDATE_CHECK_ERROR: |
| 1817 { |
| 1818 Dictionary* dictionary = Dictionary::GetInstance(); |
| 1819 std::wstring errorText = dictionary->Lookup("updater", "update-error-text"
); |
| 1820 std::wstring errorTitle = dictionary->Lookup("updater", "update-error-titl
e"); |
| 1821 pClass->notificationMessage.SetTextAndIcon(errorText, errorText, TTI_ERROR
); |
| 1822 } |
| 1823 break; |
| 1824 case WM_DOWNLOADING_UPDATE: |
| 1825 { |
| 1826 Dictionary* dictionary = Dictionary::GetInstance(); |
| 1827 std::wstring downloadingText = dictionary->Lookup("updater", "downloading-
update-text"); |
| 1828 std::wstring downloadingTitle = dictionary->Lookup("updater", "downloading
-update-title"); |
| 1829 pClass->notificationMessage.SetTextAndIcon(downloadingText, downloadingTit
le, TTI_ERROR); |
| 1830 } |
| 1831 break; |
1783 } | 1832 } |
1784 | 1833 |
1785 return DefWindowProc(hWnd, message, wParam, lParam); | 1834 return DefWindowProc(hWnd, message, wParam, lParam); |
1786 } | 1835 } |
1787 | 1836 |
1788 | 1837 |
1789 void CPluginClass::UpdateStatusBar() | 1838 void CPluginClass::UpdateStatusBar() |
1790 { | 1839 { |
1791 DEBUG_GENERAL("*** Updating statusbar") | 1840 DEBUG_GENERAL("*** Updating statusbar") |
1792 if (m_hPaneWnd == NULL) | 1841 if (m_hPaneWnd == NULL) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 } | 1961 } |
1913 } | 1962 } |
1914 } | 1963 } |
1915 | 1964 |
1916 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1965 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1917 } | 1966 } |
1918 | 1967 |
1919 return hTabWnd; | 1968 return hTabWnd; |
1920 | 1969 |
1921 } | 1970 } |
OLD | NEW |