Index: src/plugin/PluginClass.h |
diff --git a/src/plugin/PluginClass.h b/src/plugin/PluginClass.h |
index 864b8b0e23a271c3d704548a886a4dce9592348e..d6f6fb30351dc2923b0a2add4c5fed5fee2e7074 100644 |
--- a/src/plugin/PluginClass.h |
+++ b/src/plugin/PluginClass.h |
@@ -40,7 +40,7 @@ |
#define WM_LAUNCH_INFO (WM_APP + 10) |
class CPluginMimeFilterClient; |
- |
+class WebBrowserEventsListener; |
class ATL_NO_VTABLE CPluginClass : |
public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>, |
@@ -52,10 +52,6 @@ class ATL_NO_VTABLE CPluginClass : |
friend class CPluginTab; |
-private: |
- |
- CPluginTab* m_tab; |
Eric
2015/12/02 17:00:14
You've converted this to a 'unique_ptr' in the cha
Eric
2015/12/02 17:02:02
That should be "ordinary, non-allocated object".
Eric
2015/12/02 18:45:18
While auditing code, I found the same problem in '
sergei
2016/02/25 17:48:27
When I was doing it I tried to avoid changes unrel
|
- |
public: |
DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN_CLASS) |
@@ -70,7 +66,6 @@ public: |
BEGIN_SINK_MAP(CPluginClass) |
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, OnBeforeNavigate2) |
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete) |
- SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete) |
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_WINDOWSTATECHANGED, OnWindowStateChanged) |
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnCommandStateChange) |
SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_ONQUIT, OnOnQuit) |
@@ -137,17 +132,15 @@ private: |
VARIANT* Headers /**< [in] */, |
VARIANT_BOOL* Cancel /* [in, out] */); |
void STDMETHODCALLTYPE OnDownloadComplete(); |
- void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT* /*urlOrPidl*/); |
Eric
2015/12/02 17:00:14
I don't think we'll need to put this event handler
sergei
2016/02/25 17:48:27
Can you give any arguments?
|
void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask); |
void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable); |
void STDMETHODCALLTYPE OnOnQuit(); |
void Unadvise(); |
+ void EnsureWebBrowserConnected(const ATL::CComPtr<IWebBrowser2>& webBrowser); |
void ShowStatusBar(); |
bool IsStatusBarEnabled(); |
-public: |
- CComQIPtr<IWebBrowser2> m_webBrowser2; |
private: |
HWND m_hBrowserWnd; |
HWND m_hTabWnd; |
@@ -157,6 +150,15 @@ private: |
WNDPROC m_pWndProcStatus; |
int m_nPaneWidth; |
HANDLE m_hTheme; |
+ struct Data |
+ { |
+ std::map<IWebBrowser2*, WebBrowserEventsListener*> connectedWebBrowsersCache; |
sergei
2016/02/25 17:48:27
These raw pointers is another point here regarding
sergei
2016/02/26 08:34:51
BTW, in addition we probably need to serialize the
sergei
2016/02/26 16:57:56
According to my tests destructors of `WebBrowserEv
|
+ std::unique_ptr<CPluginTab> tab; |
+ ATL::CComPtr<IWebBrowser2> webBrowser2; |
+ }; |
+ // we need to have it as a shared pointer to get weak pointer to it to avoid |
+ // wrong usage after destroying of this class. |
+ std::shared_ptr<Data> m_data; |
Eric
2015/12/02 17:00:14
This struct looks like a Very Bad Idea.
If we get
sergei
2016/02/25 17:48:27
It's not about events coming to non-existing objec
|
CriticalSection m_csStatusBar; |