Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloa dComplete) | 72 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloa dComplete) |
73 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumen tComplete) | 73 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumen tComplete) |
74 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_WINDOWSTATECHANGED, OnWindo wStateChanged) | 74 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_WINDOWSTATECHANGED, OnWindo wStateChanged) |
75 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnComma ndStateChange) | 75 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnComma ndStateChange) |
76 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_ONQUIT, OnOnQuit) | 76 SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_ONQUIT, OnOnQuit) |
77 END_SINK_MAP() | 77 END_SINK_MAP() |
78 | 78 |
79 CPluginClass(); | 79 CPluginClass(); |
80 ~CPluginClass(); | 80 ~CPluginClass(); |
81 | 81 |
82 HRESULT FinalConstruct(); | |
83 void FinalRelease(); | |
84 | |
85 // IObjectWithSite | 82 // IObjectWithSite |
86 | |
87 STDMETHOD(SetSite)(IUnknown *pUnkSite); | 83 STDMETHOD(SetSite)(IUnknown *pUnkSite); |
88 | 84 |
89 // IOleCommandTarget | 85 // IOleCommandTarget |
90 | |
91 STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT* pCmdText); | 86 STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT* pCmdText); |
92 STDMETHOD(Exec)(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, VARIANTARG* pva Out); | 87 STDMETHOD(Exec)(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, VARIANTARG* pva Out); |
93 | 88 |
94 | 89 |
95 static CPluginTab* GetTab(DWORD dwThreadId); | 90 static CPluginTab* GetTab(DWORD dwThreadId); |
96 CPluginTab* GetTab(); | 91 CPluginTab* GetTab(); |
97 | 92 |
98 void UpdateStatusBar(); | 93 void UpdateStatusBar(); |
99 static DWORD WINAPI MainThreadProc(LPVOID pParam); | |
100 | 94 |
101 private: | 95 private: |
102 | 96 |
103 bool SetMenuBar(HMENU hMenu, const std::wstring& url); | 97 bool SetMenuBar(HMENU hMenu, const std::wstring& url); |
104 HMENU CreatePluginMenu(const std::wstring& url); | 98 HMENU CreatePluginMenu(const std::wstring& url); |
105 | 99 |
106 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla gs); | 100 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla gs); |
107 bool CreateStatusBarPane(); | 101 bool CreateStatusBarPane(); |
108 | 102 |
109 public: | 103 public: |
110 HWND GetBrowserHWND() const; | 104 HWND GetBrowserHWND() const; |
111 HWND GetTabHWND() const; | 105 bool IsRootPageBrowser(IWebBrowser2*); |
112 CComQIPtr<IWebBrowser2> GetBrowser() const; | |
113 | |
114 | 106 |
115 static CPluginMimeFilterClient* s_mimeFilter; | 107 static CPluginMimeFilterClient* s_mimeFilter; |
116 | 108 |
117 private: | 109 private: |
118 | 110 |
119 std::wstring GetBrowserUrl() const; | 111 std::wstring GetBrowserUrl() const; |
120 | 112 |
121 static DWORD WINAPI StartInitObject(LPVOID thisPtr); | 113 static DWORD WINAPI StartInitObject(LPVOID thisPtr); |
122 bool InitObject(); | 114 bool InitObject(); |
123 void CloseTheme(); | 115 void CloseTheme(); |
(...skipping 15 matching lines...) Expand all Loading... | |
139 void STDMETHODCALLTYPE OnDownloadComplete(); | 131 void STDMETHODCALLTYPE OnDownloadComplete(); |
140 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT * /*urlOrPidl*/); | 132 void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT * /*urlOrPidl*/); |
141 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask); | 133 void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask); |
142 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable) ; | 134 void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable) ; |
143 void STDMETHODCALLTYPE OnOnQuit(); | 135 void STDMETHODCALLTYPE OnOnQuit(); |
144 void Unadvise(); | 136 void Unadvise(); |
145 | 137 |
146 void ShowStatusBar(); | 138 void ShowStatusBar(); |
147 bool IsStatusBarEnabled(); | 139 bool IsStatusBarEnabled(); |
148 | 140 |
149 public: | 141 IWebBrowser2* m_webBrowser2; |
sergei
2015/10/01 16:15:51
I really don't understand the reluctance to use sm
Oleksandr
2015/10/05 10:44:47
+1.
Eric
2015/11/18 13:57:31
My rule: Use them when you need them and don't use
| |
150 CComQIPtr<IWebBrowser2> m_webBrowser2; | |
151 private: | |
152 HWND m_hBrowserWnd; | 142 HWND m_hBrowserWnd; |
153 HWND m_hTabWnd; | 143 HWND m_hTabWnd; |
154 HWND m_hStatusBarWnd; | 144 HWND m_hStatusBarWnd; |
155 HWND m_hPaneWnd; | 145 HWND m_hPaneWnd; |
156 | 146 |
157 WNDPROC m_pWndProcStatus; | 147 WNDPROC m_pWndProcStatus; |
158 int m_nPaneWidth; | 148 int m_nPaneWidth; |
159 HANDLE m_hTheme; | 149 HANDLE m_hTheme; |
160 | 150 |
161 CriticalSection m_csStatusBar; | 151 CriticalSection m_csStatusBar; |
(...skipping 11 matching lines...) Expand all Loading... | |
173 // Icons | 163 // Icons |
174 static HICON s_hIcons[ICON_MAX]; | 164 static HICON s_hIcons[ICON_MAX]; |
175 static DWORD s_hIconTypes[ICON_MAX]; | 165 static DWORD s_hIconTypes[ICON_MAX]; |
176 | 166 |
177 static HICON GetIcon(int type); | 167 static HICON GetIcon(int type); |
178 | 168 |
179 // Main thread | 169 // Main thread |
180 static HANDLE s_hMainThread; | 170 static HANDLE s_hMainThread; |
181 static bool s_isMainThreadDone; | 171 static bool s_isMainThreadDone; |
182 | 172 |
183 static HANDLE GetMainThreadHandle(); | |
184 static bool IsMainThreadDone(HANDLE mainThread); | |
185 | |
186 static HINSTANCE s_hUxtheme; | 173 static HINSTANCE s_hUxtheme; |
187 static std::set<CPluginClass*> s_instances; | 174 static std::set<CPluginClass*> s_instances; |
188 static std::map<DWORD,CPluginClass*> s_threadInstances; | 175 static std::map<DWORD,CPluginClass*> s_threadInstances; |
189 static CComAutoCriticalSection s_criticalSectionLocal; | 176 static CComAutoCriticalSection s_criticalSectionLocal; |
190 static CComAutoCriticalSection s_criticalSectionBrowser; | |
191 static CComAutoCriticalSection s_criticalSectionWindow; | 177 static CComAutoCriticalSection s_criticalSectionWindow; |
192 | 178 |
193 // Async browser | 179 // Async browser |
194 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; | 180 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; |
195 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); | 181 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); |
196 }; | 182 }; |
197 | 183 |
198 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) | 184 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) |
199 | 185 |
200 | 186 |
201 #endif // _PLUGIN_CLASS_H_ | 187 #endif // _PLUGIN_CLASS_H_ |
OLD | NEW |