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: address comments Created Feb. 4, 2016, 8:59 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 <thread> 32 #include <thread>
34 #include <array> 33 #include <array>
35 34
36 #ifdef DEBUG_HIDE_EL 35 #ifdef DEBUG_HIDE_EL
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 CComBSTR curLoc; 441 CComBSTR curLoc;
443 browser->get_LocationURL(&curLoc); 442 browser->get_LocationURL(&curLoc);
444 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); 443 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
445 if (FAILED(hr)) 444 if (FAILED(hr))
446 { 445 {
447 vFlags.intVal = navOpenInNewWindow; 446 vFlags.intVal = navOpenInNewWindow;
448 447
449 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); 448 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL);
450 if (FAILED(hr)) 449 if (FAILED(hr))
451 { 450 {
452 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed") 451 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed");
453 } 452 }
454 } 453 }
455 browser->Quit(); 454 browser->Quit();
456 } 455 }
457 } 456 }
458 } 457 }
459 else 458 else
460 { 459 {
461 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); 460 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state");
462 } 461 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 { 747 {
749 CriticalSection::Lock lock(m_csStatusBar); 748 CriticalSection::Lock lock(m_csStatusBar);
750 749
751 CPluginClient* client = CPluginClient::GetInstance(); 750 CPluginClient* client = CPluginClient::GetInstance();
752 751
753 std::array<wchar_t, MAX_PATH> className; 752 std::array<wchar_t, MAX_PATH> className;
754 // Get browser window and url 753 // Get browser window and url
755 HWND hBrowserWnd = GetBrowserHWND(); 754 HWND hBrowserWnd = GetBrowserHWND();
756 if (!hBrowserWnd) 755 if (!hBrowserWnd)
757 { 756 {
758 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::CreateStatusBarPane - No status bar") 757 TRACE("No window handle for browser site", HERE_F);
759 return false; 758 return false;
760 } 759 }
761 760
762 // Looking for a TabWindowClass window in IE7 761 // Looking for a TabWindowClass window in IE7
763 // the last one should be parent for statusbar 762 // the last one should be parent for statusbar
764 HWND hWndStatusBar = NULL; 763 HWND hWndStatusBar = NULL;
765 764
766 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); 765 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD);
767 UINT amoundOfNewTabs = 0; 766 UINT amoundOfNewTabs = 0;
768 HWND uniqueNewTab = NULL; 767 HWND uniqueNewTab = NULL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 { 829 {
831 hWndStatusBar = hWnd; 830 hWndStatusBar = hWnd;
832 break; 831 break;
833 } 832 }
834 833
835 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); 834 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
836 } 835 }
837 836
838 if (!hWndStatusBar) 837 if (!hWndStatusBar)
839 { 838 {
840 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar") 839 TRACE("No status bar", HERE_F);
841 return true; 840 return true;
842 } 841 }
843 842
844 // Calculate pane height 843 // Calculate pane height
845 AdblockPlus::Rectangle rcStatusBar; 844 AdblockPlus::Rectangle rcStatusBar;
846 ::GetClientRect(hWndStatusBar, &rcStatusBar); 845 ::GetClientRect(hWndStatusBar, &rcStatusBar);
847 846
848 if (rcStatusBar.Height() > 0) 847 if (rcStatusBar.Height() > 0)
849 { 848 {
850 if (rcStatusBar.Height() < iconWidth) 849 if (rcStatusBar.Height() < iconWidth)
(...skipping 23 matching lines...) Expand all
874 L"", 873 L"",
875 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 874 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
876 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), 875 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(),
877 hWndStatusBar, 876 hWndStatusBar,
878 (HMENU)3671, 877 (HMENU)3671,
879 _Module.m_hInst, 878 _Module.m_hInst,
880 NULL); 879 NULL);
881 880
882 if (!hWndNewPane) 881 if (!hWndNewPane)
883 { 882 {
884 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") 883 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx");
885 return false; 884 return false;
886 } 885 }
887 886
888 DEBUG_GENERAL("ABP window created"); 887 DEBUG_GENERAL("ABP window created");
889 m_hTabWnd = hTabWnd; 888 m_hTabWnd = hTabWnd;
890 m_hStatusBarWnd = hWndStatusBar; 889 m_hStatusBarWnd = hWndStatusBar;
891 m_hPaneWnd = hWndNewPane; 890 m_hPaneWnd = hWndNewPane;
892 891
893 UpdateTheme(); 892 UpdateTheme();
894 893
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 929
931 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL); 930 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL);
932 if (FAILED(hr)) 931 if (FAILED(hr))
933 { 932 {
934 vFlags.intVal = navOpenInNewWindow; 933 vFlags.intVal = navOpenInNewWindow;
935 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); 934 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
936 } 935 }
937 936
938 if (FAILED(hr)) 937 if (FAILED(hr))
939 { 938 {
940 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed") 939 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed");
941 } 940 }
942 } 941 }
943 void CPluginClass::CloseTheme() 942 void CPluginClass::CloseTheme()
944 { 943 {
945 if (m_hTheme) 944 if (m_hTheme)
946 { 945 {
947 if (pfnClose) 946 if (pfnClose)
948 { 947 {
949 pfnClose(m_hTheme); 948 pfnClose(m_hTheme);
950 } 949 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 auto userSettingsFileUrl = UserSettingsFileUrl(); 1118 auto userSettingsFileUrl = UserSettingsFileUrl();
1120 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length( )), userSettingsFileUrl.c_str()); 1119 ATL::CComBSTR urlToNavigate(static_cast<int>(userSettingsFileUrl.length( )), userSettingsFileUrl.c_str());
1121 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL) ; 1120 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL) ;
1122 if (FAILED(hr)) 1121 if (FAILED(hr))
1123 { 1122 {
1124 vFlags.intVal = navOpenInNewWindow; 1123 vFlags.intVal = navOpenInNewWindow;
1125 1124
1126 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL); 1125 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL);
1127 if (FAILED(hr)) 1126 if (FAILED(hr))
1128 { 1127 {
1129 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") 1128 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed");
1130 } 1129 }
1131 } 1130 }
1132 } 1131 }
1133 break; 1132 break;
1134 } 1133 }
1135 case ID_MENU_DISABLE_ON_SITE: 1134 case ID_MENU_DISABLE_ON_SITE:
1136 { 1135 {
1137 std::wstring urlString = GetTab()->GetDocumentUrl(); 1136 std::wstring urlString = GetTab()->GetDocumentUrl();
1138 std::string filterText = client->GetWhitelistingFilter(urlString); 1137 std::string filterText = client->GetWhitelistingFilter(urlString);
1139 if (!filterText.empty()) 1138 if (!filterText.empty())
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 s_criticalSectionLocal.Unlock(); 1706 s_criticalSectionLocal.Unlock();
1708 1707
1709 return icon; 1708 return icon;
1710 } 1709 }
1711 1710
1712 ATOM CPluginClass::GetAtomPaneClass() 1711 ATOM CPluginClass::GetAtomPaneClass()
1713 { 1712 {
1714 return s_atomPaneClass; 1713 return s_atomPaneClass;
1715 } 1714 }
1716 1715
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