Left: | ||
Right: |
OLD | NEW |
---|---|
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 #include "PluginFilter.h" | 6 #include "PluginFilter.h" |
7 #include "PluginMimeFilterClient.h" | 7 #include "PluginMimeFilterClient.h" |
8 #include "PluginClient.h" | 8 #include "PluginClient.h" |
9 #include "PluginClientFactory.h" | 9 #include "PluginClientFactory.h" |
10 #include "PluginMutex.h" | 10 #include "PluginMutex.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 } | 69 } |
70 }; | 70 }; |
71 } | 71 } |
72 | 72 |
73 CPluginClass::CPluginClass() | 73 CPluginClass::CPluginClass() |
74 { | 74 { |
75 //Use this line to debug memory leaks | 75 //Use this line to debug memory leaks |
76 // _CrtDumpMemoryLeaks(); | 76 // _CrtDumpMemoryLeaks(); |
77 | 77 |
78 m_isAdviced = false; | 78 m_isAdviced = false; |
79 m_nConnectionID = 0; | |
80 m_hTabWnd = NULL; | 79 m_hTabWnd = NULL; |
81 m_hStatusBarWnd = NULL; | 80 m_hStatusBarWnd = NULL; |
82 m_hPaneWnd = NULL; | 81 m_hPaneWnd = NULL; |
83 m_nPaneWidth = 0; | 82 m_nPaneWidth = 0; |
84 m_pWndProcStatus = NULL; | 83 m_pWndProcStatus = NULL; |
85 m_hTheme = NULL; | 84 m_hTheme = NULL; |
86 m_isInitializedOk = false; | 85 m_isInitializedOk = false; |
87 | 86 |
88 | 87 |
89 m_tab = new CPluginTab(this); | 88 m_tab = new CPluginTab(this); |
(...skipping 17 matching lines...) Expand all Loading... | |
107 | 106 |
108 void CPluginClass::FinalRelease() | 107 void CPluginClass::FinalRelease() |
109 { | 108 { |
110 s_criticalSectionBrowser.Lock(); | 109 s_criticalSectionBrowser.Lock(); |
111 { | 110 { |
112 m_webBrowser2.Release(); | 111 m_webBrowser2.Release(); |
113 } | 112 } |
114 s_criticalSectionBrowser.Unlock(); | 113 s_criticalSectionBrowser.Unlock(); |
115 } | 114 } |
116 | 115 |
117 | |
118 // This method tries to get a 'connection point' from the stored browser, which can be | |
119 // used to attach or detach from the stream of browser events | |
120 CComPtr<IConnectionPoint> CPluginClass::GetConnectionPoint() | |
121 { | |
122 CComQIPtr<IConnectionPointContainer, &IID_IConnectionPointContainer> pContaine r(GetBrowser()); | |
123 if (!pContainer) | |
124 { | |
125 return NULL; | |
126 } | |
127 | |
128 CComPtr<IConnectionPoint> pPoint; | |
129 HRESULT hr = pContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &pPoint) ; | |
130 if (FAILED(hr)) | |
131 { | |
132 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNEC TION_POINT, "Class::GetConnectionPoint - FindConnectionPoint") | |
133 return NULL; | |
134 } | |
135 | |
136 return pPoint; | |
137 } | |
138 | |
139 HWND CPluginClass::GetBrowserHWND() const | 116 HWND CPluginClass::GetBrowserHWND() const |
140 { | 117 { |
141 SHANDLE_PTR hBrowserWndHandle = NULL; | 118 SHANDLE_PTR hBrowserWndHandle = NULL; |
142 | 119 |
143 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 120 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
144 if (browser) | 121 if (browser) |
145 { | 122 { |
146 HRESULT hr = browser->get_HWND(&hBrowserWndHandle); | 123 HRESULT hr = browser->get_HWND(&hBrowserWndHandle); |
147 if (FAILED(hr)) | 124 if (FAILED(hr)) |
148 { | 125 { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 // Always register on startup, then check if we need to unregister in a se parate thread | 232 // Always register on startup, then check if we need to unregister in a se parate thread |
256 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 233 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
257 s_asyncWebBrowser2 = unknownSite; | 234 s_asyncWebBrowser2 = unknownSite; |
258 s_instances.insert(this); | 235 s_instances.insert(this); |
259 } | 236 } |
260 s_criticalSectionLocal.Unlock(); | 237 s_criticalSectionLocal.Unlock(); |
261 | 238 |
262 try | 239 try |
263 { | 240 { |
264 // Check if loaded as BHO | 241 // Check if loaded as BHO |
265 if (GetBrowser()) | 242 auto webBrowser = GetBrowser(); |
243 if (webBrowser) | |
266 { | 244 { |
267 DEBUG_GENERAL("Loaded as BHO"); | 245 DEBUG_GENERAL("Loaded as BHO"); |
268 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); | 246 HRESULT hr = DispEventAdvise(webBrowser); |
269 if (pPoint) | 247 if (SUCCEEDED(hr)) |
270 { | 248 { |
271 HRESULT hr = pPoint->Advise((IDispatch*)this, &m_nConnectionID); | 249 m_isAdviced = true; |
Oleksandr
2015/01/09 00:02:17
NIT: m_isAdvised. I know it was my spelling mistak
| |
272 if (SUCCEEDED(hr)) | 250 try |
273 { | 251 { |
274 m_isAdviced = true; | 252 std::thread startInitObjectThread(StartInitObject, this); |
275 | 253 startInitObjectThread.detach(); // TODO: but actually we should wait for the thread in the dtr. |
276 try | |
277 { | |
278 std::thread startInitObjectThread(StartInitObject, this); | |
279 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr. | |
280 } | |
281 catch (const std::system_error& ex) | |
282 { | |
283 auto errDescription = std::string("Class::Thread - Failed to creat e StartInitObject thread, ") + | |
284 ex.code().message() + ex.what(); | |
285 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERR OR_MAIN_THREAD_CREATE_PROCESS, errDescription.c_str()); | |
286 } | |
287 } | 254 } |
288 else | 255 catch (const std::system_error& ex) |
289 { | 256 { |
290 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice"); | 257 auto errDescription = std::string("Class::Thread - Failed to create StartInitObject thread, ") + |
258 ex.code().message() + ex.what(); | |
259 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR _MAIN_THREAD_CREATE_PROCESS, errDescription.c_str()); | |
291 } | 260 } |
292 } | 261 } |
262 else | |
263 { | |
264 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADVIC E, "Class::SetSite - Advice"); | |
265 } | |
293 } | 266 } |
294 else // Check if loaded as toolbar handler | 267 else // Check if loaded as toolbar handler |
295 { | 268 { |
296 DEBUG_GENERAL("Loaded as toolbar handler"); | 269 DEBUG_GENERAL("Loaded as toolbar handler"); |
297 CComPtr<IServiceProvider> pServiceProvider; | 270 CComPtr<IServiceProvider> pServiceProvider; |
298 | 271 |
299 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); | 272 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); |
300 if (SUCCEEDED(hr)) | 273 if (SUCCEEDED(hr)) |
301 { | 274 { |
302 if (pServiceProvider) | 275 if (pServiceProvider) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 } | 467 } |
495 } | 468 } |
496 else | 469 else |
497 { | 470 { |
498 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); | 471 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); |
499 } | 472 } |
500 } | 473 } |
501 DEBUG_GENERAL("ShowStatusBar end"); | 474 DEBUG_GENERAL("ShowStatusBar end"); |
502 } | 475 } |
503 | 476 |
504 void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams) | 477 void STDMETHODCALLTYPE CPluginClass::OnBeforeNavigate2( |
478 /* [in] */ IDispatch* frameBrowserDisp, | |
479 /* [in] */ VARIANT* urlVariant, | |
480 /* [in] */ VARIANT* /*Flags*/, | |
481 /* [in] */ VARIANT* /*TargetFrameName*/, | |
482 /* [in] */ VARIANT* /*PostData*/, | |
483 /* [in] */ VARIANT* /*Headers*/, | |
484 /* [in, out] */ VARIANT_BOOL* /*Cancel*/) | |
505 { | 485 { |
506 | 486 ATL::CComQIPtr<IWebBrowser2> webBrowser = frameBrowserDisp; |
507 if (pDispParams->cArgs < 7) | 487 if (!webBrowser) |
508 { | 488 { |
509 return; | 489 return; |
510 } | 490 } |
491 | |
492 if (!urlVariant || urlVariant->vt != VT_BSTR) | |
493 { | |
494 return; | |
495 } | |
496 std::wstring url(V_BSTR(urlVariant), SysStringLen(V_BSTR(urlVariant))); | |
Oleksandr
2015/01/09 00:02:17
I would prefer minimizing the amount of macros we
sergei
2015/01/09 16:10:30
Sure, fine for me, fixed.
| |
497 UnescapeUrl(url); | |
498 | |
511 //Register a mime filter if it's not registered yet | 499 //Register a mime filter if it's not registered yet |
512 if (s_mimeFilter == NULL) | 500 if (s_mimeFilter == NULL) |
513 { | 501 { |
514 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 502 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
515 } | 503 } |
516 | 504 |
517 // Get the IWebBrowser2 interface | 505 CString urlCString = ToCString(url); |
518 CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> WebBrowser2Ptr; | |
519 VARTYPE vt = pDispParams->rgvarg[6].vt; | |
520 if (vt == VT_DISPATCH) | |
521 { | |
522 WebBrowser2Ptr = pDispParams->rgvarg[6].pdispVal; | |
523 } | |
524 else | |
525 { | |
526 // Wrong type, return. | |
527 return; | |
528 } | |
529 | |
530 // Get the URL | |
531 CString url; | |
532 vt = pDispParams->rgvarg[5].vt; | |
533 if (vt == VT_BYREF + VT_VARIANT) | |
534 { | |
535 url = pDispParams->rgvarg[5].pvarVal->bstrVal; | |
536 | |
537 CPluginClient::UnescapeUrl(url); | |
538 } | |
539 else | |
540 { | |
541 // Wrong type, return. | |
542 return; | |
543 } | |
544 | 506 |
545 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page | 507 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page |
546 CPluginClient* client = CPluginClient::GetInstance(); | 508 CPluginClient* client = CPluginClient::GetInstance(); |
547 | 509 |
548 if (url.Find(L"javascript") == 0) | 510 if (urlCString.Find(L"javascript") == 0) |
549 { | 511 { |
550 } | 512 } |
551 else if (GetBrowser().IsEqualObject(WebBrowser2Ptr)) | 513 else if (GetBrowser().IsEqualObject(webBrowser)) |
552 { | 514 { |
553 m_tab->OnNavigate(url); | 515 m_tab->OnNavigate(urlCString); |
554 | 516 |
555 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + url + "\n=================== =============================================================") | 517 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + urlCString + "\n============ ====================================================================") |
556 | 518 |
557 #ifdef ENABLE_DEBUG_RESULT | 519 #ifdef ENABLE_DEBUG_RESULT |
558 CPluginDebug::DebugResultDomain(url); | 520 CPluginDebug::DebugResultDomain(urlCString); |
559 #endif | 521 #endif |
560 | 522 |
561 UpdateStatusBar(); | 523 UpdateStatusBar(); |
562 } | 524 } |
563 else | 525 else |
564 { | 526 { |
565 DEBUG_NAVI(L"Navi::Begin navigation url:" + url) | 527 DEBUG_NAVI(L"Navi::Begin navigation url:" + urlCString) |
566 m_tab->CacheFrame(url); | 528 m_tab->CacheFrame(urlCString); |
567 } | 529 } |
568 } | 530 } |
569 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags) | 531 |
532 void STDMETHODCALLTYPE CPluginClass::OnDownloadBegin() | |
533 { | |
534 DEBUG_NAVI("Navi::Download Begin") | |
535 } | |
536 | |
537 void STDMETHODCALLTYPE CPluginClass::OnDownloadComplete() | |
538 { | |
539 DEBUG_NAVI("Navi::Download Complete") | |
540 ATL::CComPtr<IWebBrowser2> browser = GetBrowser(); | |
541 if (browser) | |
542 { | |
543 m_tab->OnDownloadComplete(browser); | |
544 } | |
545 } | |
546 | |
547 void STDMETHODCALLTYPE CPluginClass::OnDocumentComplete(IDispatch* frameBrowserD isp, VARIANT* /*urlOrPidl*/) | |
548 { | |
549 ATL::CComQIPtr<IWebBrowser2> webBrowser2 = frameBrowserDisp; | |
550 if (!webBrowser2) | |
551 { | |
552 return; | |
553 } | |
554 ATL::CString frameSrc; | |
555 ATL::CComBSTR locationUrl; | |
556 if (FAILED(webBrowser2->get_LocationURL(&locationUrl)) && !!locationUrl) | |
557 { | |
558 return; | |
559 } | |
560 frameSrc = locationUrl; | |
561 CPluginClient::UnescapeUrl(frameSrc); | |
562 bool isRootPageBrowser = GetBrowser().IsEqualObject(webBrowser2); | |
563 m_tab->OnDocumentComplete(webBrowser2, frameSrc, isRootPageBrowser); | |
564 } | |
565 | |
566 void STDMETHODCALLTYPE CPluginClass::OnWindowStateChanged(unsigned long flags, u nsigned long validFlagsMask) | |
570 { | 567 { |
571 DEBUG_GENERAL("Tab changed"); | 568 DEBUG_GENERAL("Tab changed"); |
572 bool newtabshown = pDispParams->rgvarg[1].intVal==3; | 569 bool newtabshown = validFlagsMask == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLEC MDIDF_WINDOWSTATE_ENABLED) |
570 && flags == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLECMDIDF_WIN DOWSTATE_ENABLED); | |
573 if (newtabshown) | 571 if (newtabshown) |
574 { | 572 { |
575 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); | 573 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); |
576 if (it == s_threadInstances.end()) | 574 if (it == s_threadInstances.end()) |
577 { | 575 { |
578 s_threadInstances[::GetCurrentThreadId()] = this; | 576 s_threadInstances[::GetCurrentThreadId()] = this; |
579 | |
580 | |
581 if (!m_isInitializedOk) | 577 if (!m_isInitializedOk) |
582 { | 578 { |
583 m_isInitializedOk = true; | 579 m_isInitializedOk = true; |
584 if (!InitObject(true)) | 580 if (!InitObject(true)) |
585 { | 581 { |
586 // Unadvice(); | 582 // Unadvice(); |
587 } | 583 } |
588 UpdateStatusBar(); | 584 UpdateStatusBar(); |
589 } | 585 } |
590 } | 586 } |
591 } | 587 } |
592 notificationMessage.Hide(); | 588 notificationMessage.Hide(); |
593 DEBUG_GENERAL("Tab change end"); | 589 DEBUG_GENERAL("Tab change end"); |
594 return VARIANT_TRUE; | |
595 } | 590 } |
596 | 591 |
597 // This gets called whenever there's a browser event | 592 void STDMETHODCALLTYPE CPluginClass::OnCommandStateChange(long /*command*/, VARI ANT_BOOL /*enable*/) |
Oleksandr
2015/01/09 00:02:17
Is there any reason why parameter names are commen
| |
598 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) | |
599 { | 593 { |
600 WCHAR tmp[256]; | 594 if (m_hPaneWnd == NULL) |
601 wsprintf(tmp, L"Invoke: %d\n", dispidMember); | |
602 DEBUG_GENERAL(tmp); | |
603 switch (dispidMember) | |
604 { | 595 { |
605 | 596 CreateStatusBarPane(); |
606 case DISPID_WINDOWSTATECHANGED: | 597 } |
607 return OnTabChanged(pDispParams, wFlags); | 598 else |
608 break; | 599 { |
609 case DISPID_HTMLDOCUMENTEVENTS2_ONBEFOREUPDATE: | 600 if (CPluginClient::GetInstance()->GetIEVersion() > 6) |
610 return VARIANT_TRUE; | |
611 break; | |
612 | |
613 case DISPID_HTMLDOCUMENTEVENTS2_ONCLICK: | |
614 return VARIANT_TRUE; | |
615 break; | |
616 | |
617 case DISPID_EVMETH_ONLOAD: | |
618 DEBUG_NAVI("Navi::OnLoad") | |
619 return VARIANT_TRUE; | |
620 break; | |
621 | |
622 case DISPID_EVMETH_ONCHANGE: | |
623 return VARIANT_TRUE; | |
624 | |
625 case DISPID_EVMETH_ONMOUSEDOWN: | |
626 return VARIANT_TRUE; | |
627 | |
628 case DISPID_EVMETH_ONMOUSEENTER: | |
629 return VARIANT_TRUE; | |
630 | |
631 case DISPID_IHTMLIMGELEMENT_START: | |
632 return VARIANT_TRUE; | |
633 | |
634 case STDDISPID_XOBJ_ERRORUPDATE: | |
635 return VARIANT_TRUE; | |
636 | |
637 case STDDISPID_XOBJ_ONPROPERTYCHANGE: | |
638 return VARIANT_TRUE; | |
639 | |
640 case DISPID_READYSTATECHANGE: | |
641 DEBUG_NAVI("Navi::ReadyStateChange") | |
642 return VARIANT_TRUE; | |
643 | |
644 case DISPID_BEFORENAVIGATE: | |
645 DEBUG_NAVI("Navi::BeforeNavigate") | |
646 return VARIANT_TRUE; | |
647 case DISPID_COMMANDSTATECHANGE: | |
648 if (m_hPaneWnd == NULL) | |
649 { | 601 { |
650 CreateStatusBarPane(); | 602 RECT rect; |
651 } | 603 BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect); |
652 else | 604 if (rectRes == TRUE) |
653 { | |
654 if (CPluginClient::GetInstance()->GetIEVersion() > 6) | |
655 { | 605 { |
656 RECT rect; | 606 MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE); |
657 BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect); | |
658 if (rectRes == TRUE) | |
659 { | |
660 MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE); | |
661 } | |
662 } | |
663 } | |
664 break; | |
665 case DISPID_STATUSTEXTCHANGE: | |
666 break; | |
667 | |
668 case DISPID_BEFORENAVIGATE2: | |
669 BeforeNavigate2(pDispParams); | |
670 break; | |
671 | |
672 case DISPID_DOWNLOADBEGIN: | |
673 { | |
674 DEBUG_NAVI("Navi::Download Begin") | |
675 } | |
676 break; | |
677 | |
678 case DISPID_DOWNLOADCOMPLETE: | |
679 { | |
680 DEBUG_NAVI("Navi::Download Complete") | |
681 | |
682 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | |
683 if (browser) | |
684 { | |
685 m_tab->OnDownloadComplete(browser); | |
686 } | 607 } |
687 } | 608 } |
688 break; | |
689 | |
690 case DISPID_DOCUMENTCOMPLETE: | |
691 { | |
692 DEBUG_NAVI("Navi::Document Complete") | |
693 | |
694 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | |
695 | |
696 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_ DISPATCH) | |
697 { | |
698 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal; | |
699 if (pBrowser) | |
700 { | |
701 CString url; | |
702 CComBSTR bstrUrl; | |
703 if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(b strUrl) > 0) | |
704 { | |
705 url = bstrUrl; | |
706 | |
707 CPluginClient::UnescapeUrl(url); | |
708 | |
709 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows er)); | |
710 } | |
711 } | |
712 } | |
713 } | |
714 break; | |
715 | |
716 case DISPID_ONQUIT: | |
717 case DISPID_QUIT: | |
718 { | |
719 Unadvice(); | |
720 } | |
721 break; | |
722 | |
723 default: | |
724 { | |
725 CString did; | |
726 did.Format(L"DispId:%u", dispidMember); | |
727 | |
728 DEBUG_NAVI(L"Navi::Default " + did) | |
729 } | |
730 | |
731 // do nothing | |
732 break; | |
733 } | 609 } |
734 | |
735 return VARIANT_TRUE; | |
736 } | 610 } |
737 | 611 |
738 bool CPluginClass::InitObject(bool bBHO) | 612 bool CPluginClass::InitObject(bool bBHO) |
739 { | 613 { |
740 DEBUG_GENERAL("InitObject"); | 614 DEBUG_GENERAL("InitObject"); |
741 CPluginSettings* settings = CPluginSettings::GetInstance(); | 615 CPluginSettings* settings = CPluginSettings::GetInstance(); |
742 | 616 |
743 if (!settings->GetPluginEnabled()) | 617 if (!settings->GetPluginEnabled()) |
744 { | 618 { |
745 s_mimeFilter->Unregister(); | 619 s_mimeFilter->Unregister(); |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1724 { | 1598 { |
1725 CreateStatusBarPane(); | 1599 CreateStatusBarPane(); |
1726 } | 1600 } |
1727 if ((m_hPaneWnd != NULL) && !::InvalidateRect(m_hPaneWnd, NULL, FALSE)) | 1601 if ((m_hPaneWnd != NULL) && !::InvalidateRect(m_hPaneWnd, NULL, FALSE)) |
1728 { | 1602 { |
1729 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALID ATE_STATUSBAR, "Class::Invalidate statusbar"); | 1603 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALID ATE_STATUSBAR, "Class::Invalidate statusbar"); |
1730 } | 1604 } |
1731 } | 1605 } |
1732 | 1606 |
1733 | 1607 |
1734 void CPluginClass::Unadvice() | 1608 void STDMETHODCALLTYPE CPluginClass::Unadvice() |
1735 { | 1609 { |
1736 s_criticalSectionLocal.Lock(); | 1610 s_criticalSectionLocal.Lock(); |
1737 { | 1611 { |
1738 if (m_isAdviced) | 1612 if (m_isAdviced) |
1739 { | 1613 { |
1740 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); | 1614 HRESULT hr = DispEventUnadvise(GetBrowser()); |
1741 if (pPoint) | 1615 if (FAILED(hr)) |
1742 { | 1616 { |
1743 HRESULT hr = pPoint->Unadvise(m_nConnectionID); | 1617 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADVIC E, "Class::Unadvice - Unadvise"); |
1744 if (FAILED(hr)) | |
1745 { | |
1746 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADV ICE, "Class::Unadvice - Unadvise"); | |
1747 } | |
1748 } | 1618 } |
1749 | |
1750 m_isAdviced = false; | 1619 m_isAdviced = false; |
1751 } | 1620 } |
1752 } | 1621 } |
1753 s_criticalSectionLocal.Unlock(); | 1622 s_criticalSectionLocal.Unlock(); |
1754 } | 1623 } |
1755 | 1624 |
1756 HICON CPluginClass::GetIcon(int type) | 1625 HICON CPluginClass::GetIcon(int type) |
1757 { | 1626 { |
1758 HICON icon = NULL; | 1627 HICON icon = NULL; |
1759 | 1628 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1842 } | 1711 } |
1843 } | 1712 } |
1844 } | 1713 } |
1845 | 1714 |
1846 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1715 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1847 } | 1716 } |
1848 | 1717 |
1849 return hTabWnd; | 1718 return hTabWnd; |
1850 | 1719 |
1851 } | 1720 } |
OLD | NEW |