| 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 "PluginMimeFilterClient.h" |
| 25 #include "AdblockPlusClient.h" | 25 #include "AdblockPlusClient.h" |
| 26 #include "PluginClientBase.h" | |
| 27 #include "PluginClientFactory.h" | 26 #include "PluginClientFactory.h" |
| 28 #include "PluginUtil.h" | 27 #include "PluginUtil.h" |
| 29 #include "../shared/Utils.h" | 28 #include "../shared/Utils.h" |
| 30 #include "../shared/Dictionary.h" | 29 #include "../shared/Dictionary.h" |
| 31 #include "IeVersion.h" | 30 #include "IeVersion.h" |
| 32 #include "../shared/Version.h" | 31 #include "../shared/Version.h" |
| 33 #include <thread> | 32 #include <thread> |
| 34 #include <array> | 33 #include <array> |
| 35 | 34 |
| 36 #ifdef DEBUG_HIDE_EL | 35 #ifdef DEBUG_HIDE_EL |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 CComBSTR curLoc; | 430 CComBSTR curLoc; |
| 432 browser->get_LocationURL(&curLoc); | 431 browser->get_LocationURL(&curLoc); |
| 433 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); | 432 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); |
| 434 if (FAILED(hr)) | 433 if (FAILED(hr)) |
| 435 { | 434 { |
| 436 vFlags.intVal = navOpenInNewWindow; | 435 vFlags.intVal = navOpenInNewWindow; |
| 437 | 436 |
| 438 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); | 437 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); |
| 439 if (FAILED(hr)) | 438 if (FAILED(hr)) |
| 440 { | 439 { |
| 441 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON, "Navigation::Failed") | 440 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON, "Navigation::Failed"); |
| 442 } | 441 } |
| 443 } | 442 } |
| 444 browser->Quit(); | 443 browser->Quit(); |
| 445 } | 444 } |
| 446 } | 445 } |
| 447 } | 446 } |
| 448 else | 447 else |
| 449 { | 448 { |
| 450 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class
::Get statusbar state"); | 449 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class
::Get statusbar state"); |
| 451 } | 450 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 { | 736 { |
| 738 CriticalSection::Lock lock(m_csStatusBar); | 737 CriticalSection::Lock lock(m_csStatusBar); |
| 739 | 738 |
| 740 CPluginClient* client = CPluginClient::GetInstance(); | 739 CPluginClient* client = CPluginClient::GetInstance(); |
| 741 | 740 |
| 742 std::array<wchar_t, MAX_PATH> className; | 741 std::array<wchar_t, MAX_PATH> className; |
| 743 // Get browser window and url | 742 // Get browser window and url |
| 744 HWND hBrowserWnd = GetBrowserHWND(); | 743 HWND hBrowserWnd = GetBrowserHWND(); |
| 745 if (!hBrowserWnd) | 744 if (!hBrowserWnd) |
| 746 { | 745 { |
| 747 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C
lass::CreateStatusBarPane - No status bar") | 746 TRACE("No window handle for browser site", HERE_F); |
| 748 return false; | 747 return false; |
| 749 } | 748 } |
| 750 | 749 |
| 751 // Looking for a TabWindowClass window in IE7 | 750 // Looking for a TabWindowClass window in IE7 |
| 752 // the last one should be parent for statusbar | 751 // the last one should be parent for statusbar |
| 753 HWND hWndStatusBar = NULL; | 752 HWND hWndStatusBar = NULL; |
| 754 | 753 |
| 755 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); | 754 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); |
| 756 UINT amoundOfNewTabs = 0; | 755 UINT amoundOfNewTabs = 0; |
| 757 HWND uniqueNewTab = NULL; | 756 HWND uniqueNewTab = NULL; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 { | 818 { |
| 820 hWndStatusBar = hWnd; | 819 hWndStatusBar = hWnd; |
| 821 break; | 820 break; |
| 822 } | 821 } |
| 823 | 822 |
| 824 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); | 823 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); |
| 825 } | 824 } |
| 826 | 825 |
| 827 if (!hWndStatusBar) | 826 if (!hWndStatusBar) |
| 828 { | 827 { |
| 829 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class
::CreateStatusBarPane - No status bar") | 828 TRACE("No status bar", HERE_F); |
| 830 return true; | 829 return true; |
| 831 } | 830 } |
| 832 | 831 |
| 833 // Calculate pane height | 832 // Calculate pane height |
| 834 AdblockPlus::Rectangle rcStatusBar; | 833 AdblockPlus::Rectangle rcStatusBar; |
| 835 ::GetClientRect(hWndStatusBar, &rcStatusBar); | 834 ::GetClientRect(hWndStatusBar, &rcStatusBar); |
| 836 | 835 |
| 837 if (rcStatusBar.Height() > 0) | 836 if (rcStatusBar.Height() > 0) |
| 838 { | 837 { |
| 839 if (rcStatusBar.Height() < iconWidth) | 838 if (rcStatusBar.Height() < iconWidth) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 863 L"", | 862 L"", |
| 864 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | 863 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, |
| 865 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), | 864 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), |
| 866 hWndStatusBar, | 865 hWndStatusBar, |
| 867 (HMENU)3671, | 866 (HMENU)3671, |
| 868 _Module.m_hInst, | 867 _Module.m_hInst, |
| 869 NULL); | 868 NULL); |
| 870 | 869 |
| 871 if (!hWndNewPane) | 870 if (!hWndNewPane) |
| 872 { | 871 { |
| 873 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") | 872 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx"); |
| 874 return false; | 873 return false; |
| 875 } | 874 } |
| 876 | 875 |
| 877 DEBUG_GENERAL("ABP window created"); | 876 DEBUG_GENERAL("ABP window created"); |
| 878 m_hTabWnd = hTabWnd; | 877 m_hTabWnd = hTabWnd; |
| 879 m_hStatusBarWnd = hWndStatusBar; | 878 m_hStatusBarWnd = hWndStatusBar; |
| 880 m_hPaneWnd = hWndNewPane; | 879 m_hPaneWnd = hWndNewPane; |
| 881 | 880 |
| 882 UpdateTheme(); | 881 UpdateTheme(); |
| 883 | 882 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 918 |
| 920 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU
LL); | 919 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU
LL); |
| 921 if (FAILED(hr)) | 920 if (FAILED(hr)) |
| 922 { | 921 { |
| 923 vFlags.intVal = navOpenInNewWindow; | 922 vFlags.intVal = navOpenInNewWindow; |
| 924 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); | 923 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); |
| 925 } | 924 } |
| 926 | 925 |
| 927 if (FAILED(hr)) | 926 if (FAILED(hr)) |
| 928 { | 927 { |
| 929 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed") | 928 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed"); |
| 930 } | 929 } |
| 931 } | 930 } |
| 932 void CPluginClass::CloseTheme() | 931 void CPluginClass::CloseTheme() |
| 933 { | 932 { |
| 934 if (m_hTheme) | 933 if (m_hTheme) |
| 935 { | 934 { |
| 936 if (pfnClose) | 935 if (pfnClose) |
| 937 { | 936 { |
| 938 pfnClose(m_hTheme); | 937 pfnClose(m_hTheme); |
| 939 } | 938 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 auto userSettingsFileUrl = UserSettingsFileUrl(); | 1100 auto userSettingsFileUrl = UserSettingsFileUrl(); |
| 1102 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length(
)), userSettingsFileUrl.c_str()); | 1101 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length(
)), userSettingsFileUrl.c_str()); |
| 1103 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL)
; | 1102 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL)
; |
| 1104 if (FAILED(hr)) | 1103 if (FAILED(hr)) |
| 1105 { | 1104 { |
| 1106 vFlags.intVal = navOpenInNewWindow; | 1105 vFlags.intVal = navOpenInNewWindow; |
| 1107 | 1106 |
| 1108 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL); | 1107 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL); |
| 1109 if (FAILED(hr)) | 1108 if (FAILED(hr)) |
| 1110 { | 1109 { |
| 1111 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_SETTINGS, "Navigation::Failed") | 1110 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_SETTINGS, "Navigation::Failed"); |
| 1112 } | 1111 } |
| 1113 } | 1112 } |
| 1114 } | 1113 } |
| 1115 break; | 1114 break; |
| 1116 } | 1115 } |
| 1117 case ID_MENU_DISABLE_ON_SITE: | 1116 case ID_MENU_DISABLE_ON_SITE: |
| 1118 { | 1117 { |
| 1119 std::wstring urlString = GetTab()->GetDocumentUrl(); | 1118 std::wstring urlString = GetTab()->GetDocumentUrl(); |
| 1120 std::string filterText = client->GetWhitelistingFilter(urlString); | 1119 std::string filterText = client->GetWhitelistingFilter(urlString); |
| 1121 if (!filterText.empty()) | 1120 if (!filterText.empty()) |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 case WM_DESTROY: | 1534 case WM_DESTROY: |
| 1536 break; | 1535 break; |
| 1537 case SC_CLOSE: | 1536 case SC_CLOSE: |
| 1538 break; | 1537 break; |
| 1539 | 1538 |
| 1540 case WM_UPDATEUISTATE: | 1539 case WM_UPDATEUISTATE: |
| 1541 { | 1540 { |
| 1542 CPluginTab* tab = GetTab(::GetCurrentThreadId()); | 1541 CPluginTab* tab = GetTab(::GetCurrentThreadId()); |
| 1543 if (tab) | 1542 if (tab) |
| 1544 { | 1543 { |
| 1545 tab->OnActivate(); | |
| 1546 RECT rect; | 1544 RECT rect; |
| 1547 GetWindowRect(pClass->m_hPaneWnd, &rect); | 1545 GetWindowRect(pClass->m_hPaneWnd, &rect); |
| 1548 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) /
2, rect.top + (rect.bottom - rect.top) / 2); | 1546 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) /
2, rect.top + (rect.bottom - rect.top) / 2); |
| 1549 } | 1547 } |
| 1550 if (LOWORD(wParam) == UIS_CLEAR) | 1548 if (LOWORD(wParam) == UIS_CLEAR) |
| 1551 { | 1549 { |
| 1552 pClass->notificationMessage.Hide(); | 1550 pClass->notificationMessage.Hide(); |
| 1553 } | 1551 } |
| 1554 } | 1552 } |
| 1555 break; | 1553 break; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 s_criticalSectionLocal.Unlock(); | 1658 s_criticalSectionLocal.Unlock(); |
| 1661 | 1659 |
| 1662 return icon; | 1660 return icon; |
| 1663 } | 1661 } |
| 1664 | 1662 |
| 1665 ATOM CPluginClass::GetAtomPaneClass() | 1663 ATOM CPluginClass::GetAtomPaneClass() |
| 1666 { | 1664 { |
| 1667 return s_atomPaneClass; | 1665 return s_atomPaneClass; |
| 1668 } | 1666 } |
| 1669 | 1667 |
| OLD | NEW |