 Issue 29330403:
  Issue #1467, #3397 - Rewrite the map from threads to tabs  (Closed)
    
  
    Issue 29330403:
  Issue #1467, #3397 - Rewrite the map from threads to tabs  (Closed) 
  | 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 23 matching lines...) Expand all Loading... | |
| 34 | 34 | 
| 35 #define ICON_PLUGIN_DISABLED 0 | 35 #define ICON_PLUGIN_DISABLED 0 | 
| 36 #define ICON_PLUGIN_ENABLED 1 | 36 #define ICON_PLUGIN_ENABLED 1 | 
| 37 #define ICON_PLUGIN_DEACTIVATED 2 | 37 #define ICON_PLUGIN_DEACTIVATED 2 | 
| 38 #define ICON_MAX 3 | 38 #define ICON_MAX 3 | 
| 39 | 39 | 
| 40 #define WM_LAUNCH_INFO (WM_APP + 10) | 40 #define WM_LAUNCH_INFO (WM_APP + 10) | 
| 41 | 41 | 
| 42 class CPluginMimeFilterClient; | 42 class CPluginMimeFilterClient; | 
| 43 | 43 | 
| 44 | |
| 45 class ATL_NO_VTABLE CPluginClass : | 44 class ATL_NO_VTABLE CPluginClass : | 
| 46 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>, | 45 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>, | 
| 47 public ATL::CComCoClass<CPluginClass, &CLSID_PluginClass>, | 46 public ATL::CComCoClass<CPluginClass, &CLSID_PluginClass>, | 
| 48 public ATL::IObjectWithSiteImpl<CPluginClass>, | 47 public ATL::IObjectWithSiteImpl<CPluginClass>, | 
| 49 public IOleCommandTarget, | 48 public IOleCommandTarget, | 
| 50 public ATL::IDispEventImpl<1, CPluginClass, &DIID_DWebBrowserEvents2, &LIBID_S HDocVw, 1, 1> | 49 public ATL::IDispEventImpl<1, CPluginClass, &DIID_DWebBrowserEvents2, &LIBID_S HDocVw, 1, 1> | 
| 51 { | 50 { | 
| 52 | 51 | 
| 53 friend class CPluginTab; | 52 friend class CPluginTab; | 
| 54 | 53 | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 80 ~CPluginClass(); | 79 ~CPluginClass(); | 
| 81 | 80 | 
| 82 // IObjectWithSite | 81 // IObjectWithSite | 
| 83 STDMETHOD(SetSite)(IUnknown *pUnkSite); | 82 STDMETHOD(SetSite)(IUnknown *pUnkSite); | 
| 84 | 83 | 
| 85 // IOleCommandTarget | 84 // IOleCommandTarget | 
| 86 STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT* pCmdText); | 85 STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT* pCmdText); | 
| 87 STDMETHOD(Exec)(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, VARIANTARG* pva Out); | 86 STDMETHOD(Exec)(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, VARIANTARG* pva Out); | 
| 88 | 87 | 
| 89 | 88 | 
| 90 static CPluginTab* GetTab(DWORD dwThreadId); | 89 static CPluginTab* GetTabCurrentThread(); | 
| 
Oleksandr
2016/02/10 10:58:49
Nit: the name kind of implies the return value wou
 
Eric
2016/05/19 17:23:59
Good idea. OK.
 | |
| 91 CPluginTab* GetTab(); | 90 CPluginTab* GetTab(); | 
| 92 | 91 | 
| 93 void UpdateStatusBar(); | 92 void UpdateStatusBar(); | 
| 94 | 93 | 
| 95 private: | 94 private: | 
| 96 | 95 | 
| 97 bool SetMenuBar(HMENU hMenu, const std::wstring& url); | 96 bool SetMenuBar(HMENU hMenu, const std::wstring& url); | 
| 98 HMENU CreatePluginMenu(const std::wstring& url); | 97 HMENU CreatePluginMenu(const std::wstring& url); | 
| 99 | 98 | 
| 100 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla gs); | 99 void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFla gs); | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 static DWORD s_hIconTypes[ICON_MAX]; | 169 static DWORD s_hIconTypes[ICON_MAX]; | 
| 171 | 170 | 
| 172 static HICON GetIcon(int type); | 171 static HICON GetIcon(int type); | 
| 173 | 172 | 
| 174 // Main thread | 173 // Main thread | 
| 175 static HANDLE s_hMainThread; | 174 static HANDLE s_hMainThread; | 
| 176 static bool s_isMainThreadDone; | 175 static bool s_isMainThreadDone; | 
| 177 | 176 | 
| 178 static HINSTANCE s_hUxtheme; | 177 static HINSTANCE s_hUxtheme; | 
| 179 static std::set<CPluginClass*> s_instances; | 178 static std::set<CPluginClass*> s_instances; | 
| 180 static std::map<DWORD,CPluginClass*> s_threadInstances; | |
| 181 static CComAutoCriticalSection s_criticalSectionLocal; | 179 static CComAutoCriticalSection s_criticalSectionLocal; | 
| 182 static CComAutoCriticalSection s_criticalSectionWindow; | 180 static CComAutoCriticalSection s_criticalSectionWindow; | 
| 183 | 181 | 
| 184 // Async browser | 182 // Async browser | 
| 185 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; | 183 static CComQIPtr<IWebBrowser2> s_asyncWebBrowser2; | 
| 186 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); | 184 static CComQIPtr<IWebBrowser2> GetAsyncBrowser(); | 
| 187 }; | 185 }; | 
| 188 | 186 | 
| 189 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) | 187 OBJECT_ENTRY_AUTO(__uuidof(PluginClass), CPluginClass) | 
| 190 | 188 | 
| 191 | |
| 192 #endif // _PLUGIN_CLASS_H_ | 189 #endif // _PLUGIN_CLASS_H_ | 
| OLD | NEW |