Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 29323611: Issue #1234, #2058 - Rewrite log facility, improving thread implementation
Patch Set: rebase only Created July 27, 2016, 9:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginClass.h ('k') | src/plugin/PluginClientBase.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "Instances.h" 32 #include "Instances.h"
34 #include <thread> 33 #include <thread>
35 #include <array> 34 #include <array>
36 35
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 CComBSTR curLoc; 478 CComBSTR curLoc;
480 browser->get_LocationURL(&curLoc); 479 browser->get_LocationURL(&curLoc);
481 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); 480 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
482 if (FAILED(hr)) 481 if (FAILED(hr))
483 { 482 {
484 vFlags.intVal = navOpenInNewWindow; 483 vFlags.intVal = navOpenInNewWindow;
485 484
486 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); 485 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL);
487 if (FAILED(hr)) 486 if (FAILED(hr))
488 { 487 {
489 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed") 488 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed");
490 } 489 }
491 } 490 }
492 browser->Quit(); 491 browser->Quit();
493 } 492 }
494 } 493 }
495 } 494 }
496 else 495 else
497 { 496 {
498 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); 497 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state");
499 } 498 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 { 779 {
781 CriticalSection::Lock lock(m_csStatusBar); 780 CriticalSection::Lock lock(m_csStatusBar);
782 781
783 CPluginClient* client = CPluginClient::GetInstance(); 782 CPluginClient* client = CPluginClient::GetInstance();
784 783
785 std::array<wchar_t, MAX_PATH> className; 784 std::array<wchar_t, MAX_PATH> className;
786 // Get browser window and url 785 // Get browser window and url
787 HWND hBrowserWnd = GetBrowserHWND(); 786 HWND hBrowserWnd = GetBrowserHWND();
788 if (!hBrowserWnd) 787 if (!hBrowserWnd)
789 { 788 {
790 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::CreateStatusBarPane - No status bar") 789 TRACE("No window handle for browser site", HERE_F);
791 return false; 790 return false;
792 } 791 }
793 792
794 // Looking for a TabWindowClass window in IE7 793 // Looking for a TabWindowClass window in IE7
795 // the last one should be parent for statusbar 794 // the last one should be parent for statusbar
796 HWND hWndStatusBar = NULL; 795 HWND hWndStatusBar = NULL;
797 796
798 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); 797 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD);
799 UINT amoundOfNewTabs = 0; 798 UINT amoundOfNewTabs = 0;
800 HWND uniqueNewTab = NULL; 799 HWND uniqueNewTab = NULL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 { 861 {
863 hWndStatusBar = hWnd; 862 hWndStatusBar = hWnd;
864 break; 863 break;
865 } 864 }
866 865
867 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); 866 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
868 } 867 }
869 868
870 if (!hWndStatusBar) 869 if (!hWndStatusBar)
871 { 870 {
872 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar") 871 TRACE("No status bar", HERE_F);
873 return true; 872 return true;
874 } 873 }
875 874
876 // Calculate pane height 875 // Calculate pane height
877 AdblockPlus::Rectangle rcStatusBar; 876 AdblockPlus::Rectangle rcStatusBar;
878 ::GetClientRect(hWndStatusBar, &rcStatusBar); 877 ::GetClientRect(hWndStatusBar, &rcStatusBar);
879 878
880 if (rcStatusBar.Height() > 0) 879 if (rcStatusBar.Height() > 0)
881 { 880 {
882 if (rcStatusBar.Height() < iconWidth) 881 if (rcStatusBar.Height() < iconWidth)
(...skipping 23 matching lines...) Expand all
906 L"", 905 L"",
907 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 906 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
908 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), 907 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(),
909 hWndStatusBar, 908 hWndStatusBar,
910 (HMENU)3671, 909 (HMENU)3671,
911 _Module.m_hInst, 910 _Module.m_hInst,
912 NULL); 911 NULL);
913 912
914 if (!hWndNewPane) 913 if (!hWndNewPane)
915 { 914 {
916 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") 915 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx");
917 return false; 916 return false;
918 } 917 }
919 918
920 DEBUG_GENERAL("ABP window created"); 919 DEBUG_GENERAL("ABP window created");
921 m_hTabWnd = hTabWnd; 920 m_hTabWnd = hTabWnd;
922 m_hStatusBarWnd = hWndStatusBar; 921 m_hStatusBarWnd = hWndStatusBar;
923 m_hPaneWnd = hWndNewPane; 922 m_hPaneWnd = hWndNewPane;
924 923
925 UpdateTheme(); 924 UpdateTheme();
926 925
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 961
963 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL); 962 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL);
964 if (FAILED(hr)) 963 if (FAILED(hr))
965 { 964 {
966 vFlags.intVal = navOpenInNewWindow; 965 vFlags.intVal = navOpenInNewWindow;
967 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); 966 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
968 } 967 }
969 968
970 if (FAILED(hr)) 969 if (FAILED(hr))
971 { 970 {
972 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed") 971 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed");
973 } 972 }
974 } 973 }
975 void CPluginClass::CloseTheme() 974 void CPluginClass::CloseTheme()
976 { 975 {
977 if (m_hTheme) 976 if (m_hTheme)
978 { 977 {
979 if (pfnClose) 978 if (pfnClose)
980 { 979 {
981 pfnClose(m_hTheme); 980 pfnClose(m_hTheme);
982 } 981 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 auto userSettingsFileUrl = UserSettingsFileUrl(); 1139 auto userSettingsFileUrl = UserSettingsFileUrl();
1141 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length( )), userSettingsFileUrl.c_str()); 1140 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length( )), userSettingsFileUrl.c_str());
1142 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL) ; 1141 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL) ;
1143 if (FAILED(hr)) 1142 if (FAILED(hr))
1144 { 1143 {
1145 vFlags.intVal = navOpenInNewWindow; 1144 vFlags.intVal = navOpenInNewWindow;
1146 1145
1147 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL); 1146 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL);
1148 if (FAILED(hr)) 1147 if (FAILED(hr))
1149 { 1148 {
1150 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") 1149 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed");
1151 } 1150 }
1152 } 1151 }
1153 } 1152 }
1154 break; 1153 break;
1155 } 1154 }
1156 case ID_MENU_DISABLE_ON_SITE: 1155 case ID_MENU_DISABLE_ON_SITE:
1157 { 1156 {
1158 std::wstring urlString = GetTab()->GetDocumentUrl(); 1157 std::wstring urlString = GetTab()->GetDocumentUrl();
1159 std::string filterText = client->GetWhitelistingFilter(urlString); 1158 std::string filterText = client->GetWhitelistingFilter(urlString);
1160 if (!filterText.empty()) 1159 if (!filterText.empty())
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 s_criticalSectionLocal.Unlock(); 1727 s_criticalSectionLocal.Unlock();
1729 1728
1730 return icon; 1729 return icon;
1731 } 1730 }
1732 1731
1733 ATOM CPluginClass::GetAtomPaneClass() 1732 ATOM CPluginClass::GetAtomPaneClass()
1734 { 1733 {
1735 return s_atomPaneClass; 1734 return s_atomPaneClass;
1736 } 1735 }
1737 1736
OLDNEW
« no previous file with comments | « src/plugin/PluginClass.h ('k') | src/plugin/PluginClientBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld