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 | 15 |
16 #include "NotificationMessage.h" | 16 #include "NotificationMessage.h" |
| 17 #include "Wrapper.h" |
17 | 18 |
18 #define ICON_PLUGIN_DISABLED 0 | 19 #define ICON_PLUGIN_DISABLED 0 |
19 #define ICON_PLUGIN_ENABLED 1 | 20 #define ICON_PLUGIN_ENABLED 1 |
20 #define ICON_PLUGIN_DEACTIVATED 2 | 21 #define ICON_PLUGIN_DEACTIVATED 2 |
21 #define ICON_MAX 3 | 22 #define ICON_MAX 3 |
22 | 23 |
23 #define WM_LAUNCH_INFO (WM_APP + 10) | 24 #define WM_LAUNCH_INFO (WM_APP + 10) |
24 | 25 |
25 #ifdef SUPPORT_WHITELIST | 26 #ifdef SUPPORT_WHITELIST |
26 #define WM_WHITELIST_DOMAIN (WM_LAUNCH_INFO + 1) | 27 #define WM_WHITELIST_DOMAIN (WM_LAUNCH_INFO + 1) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 DISPPARAMS * pdispparams, VARIANT * pvarResult,EXCEPINFO * pexcepinfo, UINT
* puArgErr); | 80 DISPPARAMS * pdispparams, VARIANT * pvarResult,EXCEPINFO * pexcepinfo, UINT
* puArgErr); |
80 | 81 |
81 static CPluginTab* GetTab(DWORD dwThreadId); | 82 static CPluginTab* GetTab(DWORD dwThreadId); |
82 CPluginTab* GetTab(); | 83 CPluginTab* GetTab(); |
83 | 84 |
84 void UpdateStatusBar(); | 85 void UpdateStatusBar(); |
85 static DWORD WINAPI MainThreadProc(LPVOID pParam); | 86 static DWORD WINAPI MainThreadProc(LPVOID pParam); |
86 | 87 |
87 private: | 88 private: |
88 | 89 |
89 bool SetMenuBar(HMENU hMenu, const CString& url); | 90 bool SetMenuBar(HMENU hMenu, const std::wstring & url); |
90 HMENU CreatePluginMenu(const CString& url); | 91 HMENU CreatePluginMenu(const std::wstring & url); |
91 | 92 |
92 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla
gs); | 93 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla
gs); |
93 bool CreateStatusBarPane(); | 94 bool CreateStatusBarPane(); |
94 | 95 |
95 CComPtr<IConnectionPoint> GetConnectionPoint(); | 96 CComPtr<IConnectionPoint> GetConnectionPoint(); |
96 CComPtr<IConnectionPoint> GetConnectionPointPropSink(); | 97 CComPtr<IConnectionPoint> GetConnectionPointPropSink(); |
97 | 98 |
98 public: | 99 public: |
99 HWND GetBrowserHWND() const; | 100 HWND GetBrowserHWND() const; |
100 HWND GetTabHWND() const; | 101 HWND GetTabHWND() const; |
101 CComQIPtr<IWebBrowser2> GetBrowser() const; | 102 CComQIPtr<IWebBrowser2> GetBrowser() const; |
102 | 103 |
103 STDMETHODIMP OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags); | 104 STDMETHODIMP OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags); |
104 | 105 |
105 static CPluginMimeFilterClient* s_mimeFilter; | 106 static CPluginMimeFilterClient* s_mimeFilter; |
106 | 107 |
107 private: | 108 private: |
| 109 Wrapper::Browser browser() const |
| 110 { |
| 111 return Wrapper::Browser( GetBrowser() ); |
| 112 } |
108 | 113 |
109 CString GetBrowserUrl() const; | 114 std::wstring GetBrowserUrl() const; |
110 | 115 |
111 | 116 |
112 static DWORD WINAPI StartInitObject(LPVOID thisPtr); | 117 static DWORD WINAPI StartInitObject(LPVOID thisPtr); |
113 bool InitObject(bool bBHO); | 118 bool InitObject(bool bBHO); |
114 void CloseTheme(); | 119 void CloseTheme(); |
115 void UpdateTheme(); | 120 void UpdateTheme(); |
116 | 121 |
117 static HICON GetStatusBarIcon(const CString& url); | 122 static HICON GetStatusBarIcon(const std::wstring & url); |
118 static CPluginClass* FindInstance(HWND hStatusBarWnd); | 123 static CPluginClass* FindInstance(HWND hStatusBarWnd); |
119 static LRESULT CALLBACK NewStatusProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam); | 124 static LRESULT CALLBACK NewStatusProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam); |
120 static LRESULT CALLBACK PaneWindowProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam); | 125 static LRESULT CALLBACK PaneWindowProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam); |
121 static void FirstRunThread(); | 126 static void FirstRunThread(); |
122 void BeforeNavigate2(DISPPARAMS* pDispParams); | 127 void BeforeNavigate2(DISPPARAMS* pDispParams); |
123 | 128 |
124 void Unadvice(); | 129 void Unadvice(); |
125 | 130 |
126 void ShowStatusBar(); | 131 void ShowStatusBar(); |
127 bool IsStatusBarEnabled(); | 132 bool IsStatusBarEnabled(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 168 |
164 static HANDLE GetMainThreadHandle(); | 169 static HANDLE GetMainThreadHandle(); |
165 static bool IsMainThreadDone(HANDLE mainThread); | 170 static bool IsMainThreadDone(HANDLE mainThread); |
166 | 171 |
167 | 172 |
168 static HINSTANCE s_hUxtheme; | 173 static HINSTANCE s_hUxtheme; |
169 static CSimpleArray<CPluginClass*> s_instances; | 174 static CSimpleArray<CPluginClass*> s_instances; |
170 static std::map<DWORD,CPluginClass*> s_threadInstances; | 175 static std::map<DWORD,CPluginClass*> s_threadInstances; |
171 | 176 |
172 #ifdef SUPPORT_WHITELIST | 177 #ifdef SUPPORT_WHITELIST |
173 static std::map<UINT, CString> s_menuDomains; | 178 static std::map<UINT, std::wstring> s_menuDomains; |
174 #endif | 179 #endif |
175 | 180 |
176 static CComAutoCriticalSection s_criticalSectionLocal; | 181 static CComAutoCriticalSection s_criticalSectionLocal; |
177 static CComAutoCriticalSection s_criticalSectionBrowser; | 182 static CComAutoCriticalSection s_criticalSectionBrowser; |
178 static CComAutoCriticalSection s_criticalSectionWindow; | 183 static CComAutoCriticalSection s_criticalSectionWindow; |
179 #ifdef SUPPORT_WHITELIST | 184 #ifdef SUPPORT_WHITELIST |
180 static CComAutoCriticalSection s_criticalSectionWhiteList; | 185 static CComAutoCriticalSection s_criticalSectionWhiteList; |
181 #endif | 186 #endif |
182 | 187 |
183 // Async browser | 188 // Async browser |
184 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; | 189 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; |
185 | 190 |
186 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); | 191 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); |
187 | 192 |
188 }; | 193 }; |
189 | 194 |
190 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) | 195 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) |
191 | 196 |
192 | 197 |
193 #endif // _PLUGIN_CLASS_H_ | 198 #endif // _PLUGIN_CLASS_H_ |
OLD | NEW |