OLD | NEW |
1 /* | 1 /* |
2 * http://msdn.microsoft.com/en-us/library/bb250436.aspx | 2 * http://msdn.microsoft.com/en-us/library/bb250436.aspx |
3 */ | 3 */ |
4 | 4 |
5 #ifndef _PLUGIN_CLASS_H_ | 5 #ifndef _PLUGIN_CLASS_H_ |
6 #define _PLUGIN_CLASS_H_ | 6 #define _PLUGIN_CLASS_H_ |
7 | 7 |
8 | 8 |
9 #include "PluginTypedef.h" | 9 #include "PluginTypedef.h" |
10 #include "Plugin.h" | 10 #include "Plugin.h" |
11 #include "PluginTab.h" | 11 #include "PluginTab.h" |
12 #define _CRTDBG_MAP_ALLOC | 12 #define _CRTDBG_MAP_ALLOC |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <crtdbg.h> | 14 #include <crtdbg.h> |
15 #include <set> | 15 #include <set> |
16 | 16 |
17 #include "NotificationMessage.h" | 17 #include "NotificationMessage.h" |
18 | 18 |
19 #define ICON_PLUGIN_DISABLED 0 | 19 #define ICON_PLUGIN_DISABLED 0 |
20 #define ICON_PLUGIN_ENABLED 1 | 20 #define ICON_PLUGIN_ENABLED 1 |
21 #define ICON_PLUGIN_DEACTIVATED 2 | 21 #define ICON_PLUGIN_DEACTIVATED 2 |
22 #define ICON_MAX 3 | 22 #define ICON_MAX 3 |
23 | 23 |
24 #define WM_LAUNCH_INFO (WM_APP + 10) | 24 #define WM_LAUNCH_INFO (WM_APP + 10) |
25 #define WM_WHITELIST_DOMAIN (WM_LAUNCH_INFO + 1) | 25 #define WM_WHITELIST_DOMAIN (WM_LAUNCH_INFO + 1) |
26 | 26 |
27 class CPluginMimeFilterClient; | 27 class CPluginMimeFilterClient; |
28 | 28 class WebBrowserEventsListener; |
29 | 29 |
30 class ATL_NO_VTABLE CPluginClass : | 30 class ATL_NO_VTABLE CPluginClass : |
31 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>, | 31 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>, |
32 public ATL::CComCoClass<CPluginClass, &CLSID_PluginClass>, | 32 public ATL::CComCoClass<CPluginClass, &CLSID_PluginClass>, |
33 public ATL::IObjectWithSiteImpl<CPluginClass>, | 33 public ATL::IObjectWithSiteImpl<CPluginClass>, |
34 public IOleCommandTarget, | 34 public IOleCommandTarget, |
35 public ATL::IDispEventImpl<1, CPluginClass, &DIID_DWebBrowserEvents2, &LIBID_S
HDocVw, 1, 1> | 35 public ATL::IDispEventImpl<1, CPluginClass, &DIID_DWebBrowserEvents2, &LIBID_S
HDocVw, 1, 1> |
36 { | 36 { |
37 | 37 |
38 friend class CPluginTab; | 38 friend class CPluginTab; |
39 | 39 |
40 private: | |
41 | |
42 CPluginTab* m_tab; | |
43 | |
44 public: | 40 public: |
45 | 41 |
46 DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN_CLASS) | 42 DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN_CLASS) |
47 | 43 |
48 DECLARE_PROTECT_FINAL_CONSTRUCT() | 44 DECLARE_PROTECT_FINAL_CONSTRUCT() |
49 | 45 |
50 BEGIN_COM_MAP(CPluginClass) | 46 BEGIN_COM_MAP(CPluginClass) |
51 COM_INTERFACE_ENTRY(IObjectWithSite) | 47 COM_INTERFACE_ENTRY(IObjectWithSite) |
52 COM_INTERFACE_ENTRY(IOleCommandTarget) | 48 COM_INTERFACE_ENTRY(IOleCommandTarget) |
53 END_COM_MAP() | 49 END_COM_MAP() |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void STDMETHODCALLTYPE OnDownloadComplete(); | 123 void STDMETHODCALLTYPE OnDownloadComplete(); |
128 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT
* /*urlOrPidl*/); | 124 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT
* /*urlOrPidl*/); |
129 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long
validFlagsMask); | 125 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long
validFlagsMask); |
130 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable)
; | 126 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable)
; |
131 // OnOnQuit | 127 // OnOnQuit |
132 void STDMETHODCALLTYPE Unadvice(); | 128 void STDMETHODCALLTYPE Unadvice(); |
133 | 129 |
134 void ShowStatusBar(); | 130 void ShowStatusBar(); |
135 bool IsStatusBarEnabled(); | 131 bool IsStatusBarEnabled(); |
136 | 132 |
137 public: | |
138 CComQIPtr<IWebBrowser2> m_webBrowser2; | |
139 private: | 133 private: |
140 HWND m_hBrowserWnd; | 134 HWND m_hBrowserWnd; |
141 HWND m_hTabWnd; | 135 HWND m_hTabWnd; |
142 HWND m_hStatusBarWnd; | 136 HWND m_hStatusBarWnd; |
143 HWND m_hPaneWnd; | 137 HWND m_hPaneWnd; |
144 | 138 |
145 WNDPROC m_pWndProcStatus; | 139 WNDPROC m_pWndProcStatus; |
146 int m_nPaneWidth; | 140 int m_nPaneWidth; |
147 HANDLE m_hTheme; | 141 HANDLE m_hTheme; |
| 142 struct Data |
| 143 { |
| 144 std::map<IWebBrowser2*, WebBrowserEventsListener*> connectedWebBrowsersCache
; |
| 145 std::unique_ptr<CPluginTab> tab; |
| 146 ATL::CComPtr<IWebBrowser2> webBrowser2; |
| 147 }; |
| 148 // we need to have it as a shared pointer to get weak pointer to it to avoid |
| 149 // wrong usage after destroying of this class. |
| 150 std::shared_ptr<Data> m_data; |
148 | 151 |
149 CriticalSection m_csStatusBar; | 152 CriticalSection m_csStatusBar; |
150 | 153 |
151 NotificationMessage notificationMessage; | 154 NotificationMessage notificationMessage; |
152 | 155 |
153 bool m_isAdviced; | 156 bool m_isAdviced; |
154 bool m_isInitializedOk; | 157 bool m_isInitializedOk; |
155 | 158 |
156 // Atom pane class | 159 // Atom pane class |
157 static ATOM s_atomPaneClass; | 160 static ATOM s_atomPaneClass; |
(...skipping 24 matching lines...) Expand all Loading... |
182 | 185 |
183 // Async browser | 186 // Async browser |
184 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; | 187 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; |
185 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); | 188 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); |
186 }; | 189 }; |
187 | 190 |
188 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) | 191 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) |
189 | 192 |
190 | 193 |
191 #endif // _PLUGIN_CLASS_H_ | 194 #endif // _PLUGIN_CLASS_H_ |
OLD | NEW |