| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 typedef SyncMap<DWORD, CPluginClass*, nullptr> Base; | 75 typedef SyncMap<DWORD, CPluginClass*, nullptr> Base; |
| 76 | 76 |
| 77 public: | 77 public: |
| 78 bool AddIfAbsent(CPluginClass* p) | 78 bool AddIfAbsent(CPluginClass* p) |
| 79 { | 79 { |
| 80 return Base::AddIfAbsent(::GetCurrentThreadId(), p); | 80 return Base::AddIfAbsent(::GetCurrentThreadId(), p); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool RemoveAndCheck() | 83 bool RemoveAndCheck() |
| 84 { | 84 { |
| 85 return Base::RemoveAndCheck(::GetCurrentThreadId()); | 85 return Base::RemoveIfPresent(::GetCurrentThreadId()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 CPluginClass* Locate() | 88 CPluginClass* Locate() |
| 89 { | 89 { |
| 90 return Base::Locate(::GetCurrentThreadId()); | 90 return Base::Locate(::GetCurrentThreadId()); |
| 91 } | 91 } |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Map from thread ID's to CPluginClass instances | 95 * Map from thread ID's to CPluginClass instances |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 s_criticalSectionLocal.Unlock(); | 1017 s_criticalSectionLocal.Unlock(); |
| 1018 | 1018 |
| 1019 return result; | 1019 return result; |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 CPluginTab* CPluginClass::GetTab() | 1022 CPluginTab* CPluginClass::GetTab() |
| 1023 { | 1023 { |
| 1024 return m_tab; | 1024 return m_tab; |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 CPluginTab* CPluginClass::GetTabCurrentThread() | 1027 CPluginTab* CPluginClass::GetTabForCurrentThread() |
| 1028 { | 1028 { |
| 1029 auto p = threadMap.Locate(); | 1029 auto p = threadMap.Locate(); |
| 1030 return p ? p->m_tab : nullptr; | 1030 return p ? p->m_tab : nullptr; |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 // Entry point | 1033 // Entry point |
| 1034 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) | 1034 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) |
| 1035 { | 1035 { |
| 1036 try | 1036 try |
| 1037 { | 1037 { |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1431 } | 1431 } |
| 1432 return ::CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, lPara m); | 1432 return ::CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, lPara m); |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 | 1435 |
| 1436 HICON CPluginClass::GetStatusBarIcon(const std::wstring& url) | 1436 HICON CPluginClass::GetStatusBarIcon(const std::wstring& url) |
| 1437 { | 1437 { |
| 1438 // use the disable icon as defualt, if the client doesn't exists | 1438 // use the disable icon as defualt, if the client doesn't exists |
| 1439 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED); | 1439 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED); |
| 1440 | 1440 |
| 1441 CPluginTab* tab = GetTabCurrentThread(); | 1441 CPluginTab* tab = GetTabForCurrentThread(); |
| 1442 if (tab) | 1442 if (tab) |
| 1443 { | 1443 { |
| 1444 CPluginClient* client = CPluginClient::GetInstance(); | 1444 CPluginClient* client = CPluginClient::GetInstance(); |
| 1445 if (CPluginSettings::GetInstance()->IsPluginEnabled()) | 1445 if (CPluginSettings::GetInstance()->IsPluginEnabled()) |
| 1446 { | 1446 { |
| 1447 if (client->IsWhitelistedUrl(url)) | 1447 if (client->IsWhitelistedUrl(url)) |
| 1448 { | 1448 { |
| 1449 hIcon = GetIcon(ICON_PLUGIN_DISABLED); | 1449 hIcon = GetIcon(ICON_PLUGIN_DISABLED); |
| 1450 } | 1450 } |
| 1451 else | 1451 else |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1595 pClass->DisplayPluginMenu(hMenu, -1, pt, TPM_LEFTALIGN | TPM_BOTTOMALIGN ); | 1595 pClass->DisplayPluginMenu(hMenu, -1, pt, TPM_LEFTALIGN | TPM_BOTTOMALIGN ); |
| 1596 break; | 1596 break; |
| 1597 } | 1597 } |
| 1598 case WM_DESTROY: | 1598 case WM_DESTROY: |
| 1599 break; | 1599 break; |
| 1600 case SC_CLOSE: | 1600 case SC_CLOSE: |
| 1601 break; | 1601 break; |
| 1602 | 1602 |
| 1603 case WM_UPDATEUISTATE: | 1603 case WM_UPDATEUISTATE: |
| 1604 { | 1604 { |
| 1605 CPluginTab* tab = GetTabCurrentThread(); | 1605 CPluginTab* tab = GetTabForCurrentThread(); |
|
Oleksandr
2016/02/10 10:58:49
Nit: I think the whitespace change here is acciden
Eric
2016/05/19 17:23:58
Yes. Fixed.
| |
| 1606 if (tab) | 1606 if (tab) |
| 1607 { | 1607 { |
| 1608 tab->OnActivate(); | 1608 tab->OnActivate(); |
| 1609 RECT rect; | 1609 RECT rect; |
| 1610 GetWindowRect(pClass->m_hPaneWnd, &rect); | 1610 GetWindowRect(pClass->m_hPaneWnd, &rect); |
| 1611 pClass->notificationMessage.MoveToCenter(rect); | 1611 pClass->notificationMessage.MoveToCenter(rect); |
| 1612 } | 1612 } |
| 1613 if (LOWORD(wParam) == UIS_CLEAR) | 1613 if (LOWORD(wParam) == UIS_CLEAR) |
| 1614 { | 1614 { |
| 1615 pClass->notificationMessage.Hide(); | 1615 pClass->notificationMessage.Hide(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1728 s_criticalSectionLocal.Unlock(); | 1728 s_criticalSectionLocal.Unlock(); |
| 1729 | 1729 |
| 1730 return icon; | 1730 return icon; |
| 1731 } | 1731 } |
| 1732 | 1732 |
| 1733 ATOM CPluginClass::GetAtomPaneClass() | 1733 ATOM CPluginClass::GetAtomPaneClass() |
| 1734 { | 1734 { |
| 1735 return s_atomPaneClass; | 1735 return s_atomPaneClass; |
| 1736 } | 1736 } |
| 1737 | 1737 |
| LEFT | RIGHT |