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

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

Issue 11450010: IE6 status bar and FRP fix. Debugging info added. (Closed)
Patch Set: Created Aug. 19, 2013, 8:12 a.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/PluginTabBase.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 #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"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 s_asyncWebBrowser2 = unknownSite; 264 s_asyncWebBrowser2 = unknownSite;
265 s_instances.Add(this); 265 s_instances.Add(this);
266 } 266 }
267 s_criticalSectionLocal.Unlock(); 267 s_criticalSectionLocal.Unlock();
268 268
269 try 269 try
270 { 270 {
271 // Check if loaded as BHO 271 // Check if loaded as BHO
272 if (GetBrowser()) 272 if (GetBrowser())
273 { 273 {
274 DEBUG_GENERAL("Loaded as BHO");
274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); 275 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
275 if (pPoint) 276 if (pPoint)
276 { 277 {
277 HRESULT hr = pPoint->Advise((IDispatch*)this, &m_nConnectionID); 278 HRESULT hr = pPoint->Advise((IDispatch*)this, &m_nConnectionID);
278 if (SUCCEEDED(hr)) 279 if (SUCCEEDED(hr))
279 { 280 {
280 m_isAdviced = true; 281 m_isAdviced = true;
281 282
282 DWORD id; 283 DWORD id;
283 HANDLE handle = ::CreateThread(NULL, 0, StartInitObject, (LPVOID)thi s, NULL, &id); 284 HANDLE handle = ::CreateThread(NULL, 0, StartInitObject, (LPVOID)thi s, NULL, &id);
284 if (handle == NULL) 285 if (handle == NULL)
285 { 286 {
286 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_THREAD, PLUGIN_ERRO R_MAIN_THREAD_CREATE_PROCESS, "Class::Thread - Failed to create main thread"); 287 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_THREAD, PLUGIN_ERRO R_MAIN_THREAD_CREATE_PROCESS, "Class::Thread - Failed to create main thread");
287 } 288 }
288 289
289 } 290 }
290 else 291 else
291 { 292 {
292 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice"); 293 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice");
293 } 294 }
294 } 295 }
295 } 296 }
296 else // Check if loaded as toolbar handler 297 else // Check if loaded as toolbar handler
297 { 298 {
299 DEBUG_GENERAL("Loaded as toolbar handler");
298 CComPtr<IServiceProvider> pServiceProvider; 300 CComPtr<IServiceProvider> pServiceProvider;
299 301
300 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); 302 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider);
301 if (SUCCEEDED(hr)) 303 if (SUCCEEDED(hr))
302 { 304 {
303 if (pServiceProvider) 305 if (pServiceProvider)
304 { 306 {
305 s_criticalSectionBrowser.Lock(); 307 s_criticalSectionBrowser.Lock();
306 { 308 {
307 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2); 309 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2);
(...skipping 13 matching lines...) Expand all
321 } 323 }
322 } 324 }
323 else 325 else
324 { 326 {
325 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)"); 327 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)");
326 } 328 }
327 } 329 }
328 } 330 }
329 catch (std::runtime_error e) 331 catch (std::runtime_error e)
330 { 332 {
333 DEBUG_ERROR(e.what());
331 Unadvice(); 334 Unadvice();
332 } 335 }
333 } 336 }
334 else 337 else
335 { 338 {
336 // Unadvice 339 // Unadvice
337 Unadvice(); 340 Unadvice();
338 341
339 // Destroy window 342 // Destroy window
340 if (m_pWndProcStatus) 343 if (m_pWndProcStatus)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================") 386 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================")
384 387
385 ::CoUninitialize(); 388 ::CoUninitialize();
386 } 389 }
387 390
388 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); 391 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite);
389 } 392 }
390 393
391 bool CPluginClass::IsStatusBarEnabled() 394 bool CPluginClass::IsStatusBarEnabled()
392 { 395 {
396 DEBUG_GENERAL("IsStatusBarEnabled start");
393 HKEY pHkey; 397 HKEY pHkey;
394 HKEY pHkeySub; 398 HKEY pHkeySub;
395 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); 399 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey);
396 DWORD trueth = 1; 400 DWORD trueth = 1;
397 DWORD truethSize = sizeof(DWORD); 401 DWORD truethSize = sizeof(DWORD);
398 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); 402 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub);
399 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&true th, &truethSize); 403 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&true th, &truethSize);
400 RegCloseKey(pHkey); 404 RegCloseKey(pHkey);
401 if (res != ERROR_SUCCESS) 405 if (res != ERROR_SUCCESS)
402 { 406 {
403 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p HkeySub); 407 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p HkeySub);
404 if (res == ERROR_SUCCESS) 408 if (res == ERROR_SUCCESS)
405 { 409 {
406 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*) &trueth, &truethSize); 410 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*) &trueth, &truethSize);
407 if (res == ERROR_SUCCESS) 411 if (res == ERROR_SUCCESS)
408 { 412 {
409 RegCloseKey(pHkey); 413 RegCloseKey(pHkey);
410 } 414 }
411 } 415 }
412 } 416 }
417 DEBUG_GENERAL("IsStatusBarEnabled end");
413 return trueth == 1; 418 return trueth == 1;
414 } 419 }
415 420
416 void CPluginClass::ShowStatusBar() 421 void CPluginClass::ShowStatusBar()
417 { 422 {
423 DEBUG_GENERAL("ShowStatusBar start");
424
418 VARIANT_BOOL isVisible; 425 VARIANT_BOOL isVisible;
419 426
420 427
421 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); 428 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser();
422 if (browser) 429 if (browser)
423 { 430 {
424 HRESULT hr = S_OK; 431 HRESULT hr = S_OK;
425 hr = browser->get_StatusBar(&isVisible); 432 hr = browser->get_StatusBar(&isVisible);
426 if (SUCCEEDED(hr)) 433 if (SUCCEEDED(hr))
427 { 434 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 494 }
488 browser->Quit(); 495 browser->Quit();
489 } 496 }
490 } 497 }
491 } 498 }
492 else 499 else
493 { 500 {
494 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); 501 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state");
495 } 502 }
496 } 503 }
504 DEBUG_GENERAL("ShowStatusBar end");
497 } 505 }
498 506
499 void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams) 507 void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams)
500 { 508 {
501 509
502 if (pDispParams->cArgs < 7) 510 if (pDispParams->cArgs < 7)
503 { 511 {
504 return; 512 return;
505 } 513 }
506 //Register a mime filter if it's not registered yet 514 //Register a mime filter if it's not registered yet
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 { 567 {
560 DEBUG_NAVI(L"Navi::Begin navigation url:" + url) 568 DEBUG_NAVI(L"Navi::Begin navigation url:" + url)
561 569
562 #ifdef SUPPORT_FRAME_CACHING 570 #ifdef SUPPORT_FRAME_CACHING
563 m_tab->CacheFrame(url); 571 m_tab->CacheFrame(url);
564 #endif 572 #endif
565 } 573 }
566 } 574 }
567 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags) 575 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags)
568 { 576 {
577 DEBUG_GENERAL("Tab changed");
569 bool newtabshown = pDispParams->rgvarg[1].intVal==3; 578 bool newtabshown = pDispParams->rgvarg[1].intVal==3;
570 if (newtabshown) 579 if (newtabshown)
571 { 580 {
572 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); 581 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId());
573 if (it == s_threadInstances.end()) 582 if (it == s_threadInstances.end())
574 { 583 {
575 s_threadInstances[::GetCurrentThreadId()] = this; 584 s_threadInstances[::GetCurrentThreadId()] = this;
576 585
577 586
578 if (!m_isInitializedOk) 587 if (!m_isInitializedOk)
579 { 588 {
580 m_isInitializedOk = true; 589 m_isInitializedOk = true;
581 if (!InitObject(true)) 590 if (!InitObject(true))
582 { 591 {
583 // Unadvice(); 592 // Unadvice();
584 } 593 }
585 UpdateStatusBar(); 594 UpdateStatusBar();
586 } 595 }
587 } 596 }
588 } 597 }
598 DEBUG_GENERAL("Tab change end");
589 return VARIANT_TRUE; 599 return VARIANT_TRUE;
590 } 600 }
591 601
592 // This gets called whenever there's a browser event 602 // This gets called whenever there's a browser event
593 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) 603 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
594 { 604 {
595 WCHAR tmp[256]; 605 WCHAR tmp[256];
596 wsprintf(tmp, L"Invoke: %d\n", dispidMember); 606 wsprintf(tmp, L"Invoke: %d\n", dispidMember);
597 DEBUG_GENERAL(tmp); 607 DEBUG_GENERAL(tmp);
598 switch (dispidMember) 608 switch (dispidMember)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 case DISPID_BEFORENAVIGATE: 649 case DISPID_BEFORENAVIGATE:
640 DEBUG_NAVI("Navi::BeforeNavigate") 650 DEBUG_NAVI("Navi::BeforeNavigate")
641 return VARIANT_TRUE; 651 return VARIANT_TRUE;
642 case DISPID_COMMANDSTATECHANGE: 652 case DISPID_COMMANDSTATECHANGE:
643 if (m_hPaneWnd == NULL) 653 if (m_hPaneWnd == NULL)
644 { 654 {
645 CreateStatusBarPane(); 655 CreateStatusBarPane();
646 } 656 }
647 else 657 else
648 { 658 {
649 RECT rect; 659 if (CPluginClient::GetInstance()->GetIEVersion() > 6)
650 BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect);
651 if (rectRes == TRUE)
652 { 660 {
653 MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE); 661 RECT rect;
654 } 662 BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect);
663 if (rectRes == TRUE)
664 {
665 MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE);
Oleksandr 2013/08/19 08:19:13 This repositions the icon when IE is resized. IE6
666 }
667 }
655 } 668 }
656 break; 669 break;
657 case DISPID_STATUSTEXTCHANGE: 670 case DISPID_STATUSTEXTCHANGE:
658 break; 671 break;
659 672
660 case DISPID_BEFORENAVIGATE2: 673 case DISPID_BEFORENAVIGATE2:
661 BeforeNavigate2(pDispParams); 674 BeforeNavigate2(pDispParams);
662 break; 675 break;
663 676
664 case DISPID_DOWNLOADBEGIN: 677 case DISPID_DOWNLOADBEGIN:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 735
723 // do nothing 736 // do nothing
724 break; 737 break;
725 } 738 }
726 739
727 return VARIANT_TRUE; 740 return VARIANT_TRUE;
728 } 741 }
729 742
730 bool CPluginClass::InitObject(bool bBHO) 743 bool CPluginClass::InitObject(bool bBHO)
731 { 744 {
745 DEBUG_GENERAL("InitObject");
732 CPluginSettings* settings = CPluginSettings::GetInstance(); 746 CPluginSettings* settings = CPluginSettings::GetInstance();
733 747
734 if (!settings->GetPluginEnabled()) 748 if (!settings->GetPluginEnabled())
735 { 749 {
736 s_mimeFilter->Unregister(); 750 s_mimeFilter->Unregister();
737 } 751 }
738 752
739 // Load theme module 753 // Load theme module
740 s_criticalSectionLocal.Lock(); 754 s_criticalSectionLocal.Lock();
741 { 755 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 s_criticalSectionLocal.Unlock(); 809 s_criticalSectionLocal.Unlock();
796 810
797 if (!GetAtomPaneClass()) 811 if (!GetAtomPaneClass())
798 { 812 {
799 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); 813 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, "Class::InitObject - RegisterClassEx");
800 return false; 814 return false;
801 } 815 }
802 } 816 }
803 817
804 818
819 int ieVersion = CPluginClient::GetInstance()->GetIEVersion();
805 // Create status pane 820 // Create status pane
806 if (bBHO) 821 if (bBHO && ieVersion > 6)
Oleksandr 2013/08/19 08:19:13 This is an actual fix of the status bar icon for I
807 { 822 {
808 if (!CreateStatusBarPane()) 823 if (!CreateStatusBarPane())
Wladimir Palant 2013/08/19 14:49:40 This nested if isn't actually necessary, it can be
809 { 824 {
810 return false; 825 return false;
811 } 826 }
812 } 827 }
813 828
814 if (CPluginClient::GetInstance()->IsFirstRun()) 829 if (CPluginClient::GetInstance()->IsFirstRun())
815 { 830 {
816 // IE6 can't be accessed from another thread, execute in current thread 831 // IE6 can't be accessed from another thread, execute in current thread
817 if (CPluginClient::GetInstance()->GetIEVersion() < 7) 832 if (ieVersion < 7)
818 { 833 {
819 FirstRunThread(); 834 FirstRunThread();
820 } 835 }
821 else 836 else
822 { 837 {
823 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThr ead, NULL, NULL, NULL); 838 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThr ead, NULL, NULL, NULL);
824 } 839 }
825 if ((m_hPaneWnd == NULL) || (!IsStatusBarEnabled())) 840 if ((m_hPaneWnd == NULL) || (!IsStatusBarEnabled()))
826 { 841 {
827 ShowStatusBar(); 842 ShowStatusBar();
828 } 843 }
829 844
830 } 845 }
831 return true; 846 return true;
832 } 847 }
833 848
834 bool CPluginClass::CreateStatusBarPane() 849 bool CPluginClass::CreateStatusBarPane()
835 { 850 {
836 DEBUG_GENERAL(L"Getting client"); 851 DEBUG_GENERAL(L"Going to create status bar");
852 CriticalSection::Lock lock(m_csStatusBar);
853 DEBUG_GENERAL(L"Create status bar");
837 854
838 CPluginClient* client = CPluginClient::GetInstance(); 855 CPluginClient* client = CPluginClient::GetInstance();
839 856
840 DEBUG_GENERAL(L"Getting ieversion");
841
842 if (client->GetIEVersion()< 7)
843
844 return true;
845
846 TCHAR szClassName[MAX_PATH]; 857 TCHAR szClassName[MAX_PATH];
847 DEBUG_GENERAL(L"Getting browser wnd"); 858 DEBUG_GENERAL(L"Getting browser wnd");
848 // Get browser window and url 859 // Get browser window and url
849 HWND hBrowserWnd = GetBrowserHWND(); 860 HWND hBrowserWnd = GetBrowserHWND();
850 if (!hBrowserWnd) 861 if (!hBrowserWnd)
851 { 862 {
852 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::CreateStatusBarPane - No status bar") 863 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::CreateStatusBarPane - No status bar")
853 return false; 864 return false;
854 } 865 }
855 866
856 // Looking for a TabWindowClass window in IE7 867 // Looking for a TabWindowClass window in IE7
857 // the last one should be parent for statusbar 868 // the last one should be parent for statusbar
858 HWND hWndStatusBar = NULL; 869 HWND hWndStatusBar = NULL;
859 870
860 DEBUG_GENERAL(L"Locating status bar window"); 871 DEBUG_GENERAL(L"Locating status bar window");
861 872
862 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); 873 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD);
863 UINT amoundOfNewTabs = 0; 874 UINT amoundOfNewTabs = 0;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 942 }
932 943
933 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); 944 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
934 } 945 }
935 946
936 DEBUG_GENERAL(L"Status bar located 2"); 947 DEBUG_GENERAL(L"Status bar located 2");
937 948
938 if (!hWndStatusBar) 949 if (!hWndStatusBar)
939 { 950 {
940 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar") 951 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar")
941 return true; 952 return true;
942 } 953 }
943 954
944 // Calculate pane height 955 // Calculate pane height
945 CRect rcStatusBar; 956 CRect rcStatusBar;
946 ::GetClientRect(hWndStatusBar, &rcStatusBar); 957 ::GetClientRect(hWndStatusBar, &rcStatusBar);
947 958
948 if (rcStatusBar.Height() > 0) 959 if (rcStatusBar.Height() > 0)
949 { 960 {
950 #ifdef _DEBUG 961 #ifdef _DEBUG
951 m_nPaneWidth = 70; 962 m_nPaneWidth = 70;
(...skipping 17 matching lines...) Expand all
969 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 980 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
970 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(), 981 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(),
971 hWndStatusBar, 982 hWndStatusBar,
972 (HMENU)3671, 983 (HMENU)3671,
973 _Module.m_hInst, 984 _Module.m_hInst,
974 NULL); 985 NULL);
975 986
976 if (!hWndNewPane) 987 if (!hWndNewPane)
977 { 988 {
978 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") 989 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx")
979 return false; 990 return false;
980 } 991 }
981 992
993 DEBUG_GENERAL("ABP window created");
982 m_hTabWnd = hTabWnd; 994 m_hTabWnd = hTabWnd;
983 m_hStatusBarWnd = hWndStatusBar; 995 m_hStatusBarWnd = hWndStatusBar;
984 m_hPaneWnd = hWndNewPane; 996 m_hPaneWnd = hWndNewPane;
985 997
986 UpdateTheme(); 998 UpdateTheme();
987 999
988 // Subclass status bar 1000 // Subclass status bar
989 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc); 1001 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc);
990 1002
1003 DEBUG_GENERAL("SetWindowLongPtr done");
991 // Adjust pane 1004 // Adjust pane
992 UINT nPartCount = ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, 0, 0); 1005 UINT nPartCount = ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, 0, 0);
993 1006
994 if (nPartCount > 1) 1007 if (nPartCount > 1)
995 { 1008 {
996 INT *pData = new INT[nPartCount]; 1009 INT *pData = new INT[nPartCount];
997 1010
998 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); 1011 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData);
999 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); 1012 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData);
1000 1013
1001 delete[] pData; 1014 delete []pData;
1002 } 1015 }
1016
1017 DEBUG_GENERAL("Pane adjusted");
1018
1003 HDC hdc = GetWindowDC(m_hStatusBarWnd); 1019 HDC hdc = GetWindowDC(m_hStatusBarWnd);
1004 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); 1020 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0);
1005 ReleaseDC(m_hStatusBarWnd, hdc); 1021 ReleaseDC(m_hStatusBarWnd, hdc);
1006 1022
1023 DEBUG_GENERAL("Released DC");
1007 return true; 1024 return true;
1008 } 1025 }
1009 1026
1010 void CPluginClass::FirstRunThread() 1027 void CPluginClass::FirstRunThread()
1011 { 1028 {
1012 CoInitialize(NULL); 1029 CoInitialize(NULL);
1013 VARIANT vFlags; 1030 VARIANT vFlags;
1014 vFlags.vt = VT_I4; 1031 vFlags.vt = VT_I4;
1015 vFlags.intVal = navOpenInNewTab; 1032 vFlags.intVal = navOpenInNewTab;
1016 1033
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (cCmds == 0) return E_INVALIDARG; 1120 if (cCmds == 0) return E_INVALIDARG;
1104 if (prgCmds == 0) return E_POINTER; 1121 if (prgCmds == 0) return E_POINTER;
1105 1122
1106 prgCmds[0].cmdf = OLECMDF_ENABLED; 1123 prgCmds[0].cmdf = OLECMDF_ENABLED;
1107 1124
1108 return S_OK; 1125 return S_OK;
1109 } 1126 }
1110 1127
1111 HMENU CPluginClass::CreatePluginMenu(const CString& url) 1128 HMENU CPluginClass::CreatePluginMenu(const CString& url)
1112 { 1129 {
1130 DEBUG_GENERAL("CreatePluginMenu");
1113 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance(); 1131 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance();
1114 1132
1115 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)); 1133 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
1116 1134
1117 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0); 1135 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0);
1118 1136
1119 SetMenuBar(hMenuTrackPopup, url); 1137 SetMenuBar(hMenuTrackPopup, url);
1120 1138
1121 return hMenuTrackPopup; 1139 return hMenuTrackPopup;
1122 } 1140 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 break; 1354 break;
1337 } 1355 }
1338 1356
1339 // Invalidate and redraw the control 1357 // Invalidate and redraw the control
1340 UpdateStatusBar(); 1358 UpdateStatusBar();
1341 } 1359 }
1342 1360
1343 1361
1344 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) 1362 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url)
1345 { 1363 {
1364 DEBUG_GENERAL("SetMenuBar");
1365
1346 std::wstring ctext; 1366 std::wstring ctext;
1347 1367
1348 s_criticalSectionLocal.Lock(); 1368 s_criticalSectionLocal.Lock();
1349 { 1369 {
1350 #ifdef SUPPORT_WHITELIST 1370 #ifdef SUPPORT_WHITELIST
1351 s_menuDomains.clear(); 1371 s_menuDomains.clear();
1352 #endif 1372 #endif
1353 } 1373 }
1354 s_criticalSectionLocal.Unlock(); 1374 s_criticalSectionLocal.Unlock();
1355 1375
1356 CPluginTab* tab = GetTab(::GetCurrentThreadId());
1357 if (!tab)
1358 {
1359 return false;
1360 }
1361 1376
1362 Dictionary* dictionary = Dictionary::GetInstance(); 1377 Dictionary* dictionary = Dictionary::GetInstance();
1363 1378
1364 MENUITEMINFOW fmii; 1379 MENUITEMINFOW fmii;
1365 memset(&fmii, 0, sizeof(MENUITEMINFO)); 1380 memset(&fmii, 0, sizeof(MENUITEMINFO));
1366 fmii.cbSize = sizeof(MENUITEMINFO); 1381 fmii.cbSize = sizeof(MENUITEMINFO);
1367 1382
1368 MENUITEMINFOW miiSep; 1383 MENUITEMINFOW miiSep;
1369 memset(&miiSep, 0, sizeof(MENUITEMINFO)); 1384 memset(&miiSep, 0, sizeof(MENUITEMINFO));
1370 miiSep.cbSize = sizeof(MENUITEMINFO); 1385 miiSep.cbSize = sizeof(MENUITEMINFO);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 break; 1798 break;
1784 } 1799 }
1785 1800
1786 return DefWindowProc(hWnd, message, wParam, lParam); 1801 return DefWindowProc(hWnd, message, wParam, lParam);
1787 } 1802 }
1788 1803
1789 1804
1790 void CPluginClass::UpdateStatusBar() 1805 void CPluginClass::UpdateStatusBar()
1791 { 1806 {
1792 DEBUG_GENERAL("*** Updating statusbar") 1807 DEBUG_GENERAL("*** Updating statusbar")
1793 1808 if (m_hPaneWnd == NULL)
1794 if (m_hPaneWnd == NULL) 1809 {
1810 CreateStatusBarPane();
1811 }
1812 if (m_hPaneWnd != NULL)
1813 {
1814 if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE))
Felix Dahlke 2013/08/19 08:31:17 No need for a nested if, you can merge this with t
1795 { 1815 {
1796 CreateStatusBarPane(); 1816 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALID ATE_STATUSBAR, "Class::Invalidate statusbar");
1797 } 1817 }
1798 if (m_hPaneWnd != NULL) 1818 }
1799 {
1800 if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE))
1801 {
1802 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVAL IDATE_STATUSBAR, "Class::Invalidate statusbar");
1803 }
1804 }
1805 } 1819 }
1806 1820
1807 1821
1808 void CPluginClass::Unadvice() 1822 void CPluginClass::Unadvice()
1809 { 1823 {
1810 s_criticalSectionLocal.Lock(); 1824 s_criticalSectionLocal.Lock();
1811 { 1825 {
1812 if (m_isAdviced) 1826 if (m_isAdviced)
1813 { 1827 {
1814 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); 1828 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } 1931 }
1918 } 1932 }
1919 } 1933 }
1920 1934
1921 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1935 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1922 } 1936 }
1923 1937
1924 return hTabWnd; 1938 return hTabWnd;
1925 1939
1926 } 1940 }
OLDNEW
« no previous file with comments | « src/plugin/PluginClass.h ('k') | src/plugin/PluginTabBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld