Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
5 #include "PluginSystem.h" | 5 #include "PluginSystem.h" |
6 #include "PluginFilter.h" | 6 #include "PluginFilter.h" |
7 #include "PluginMimeFilterClient.h" | 7 #include "PluginMimeFilterClient.h" |
8 #include "PluginClient.h" | 8 #include "PluginClient.h" |
9 #include "PluginClientFactory.h" | 9 #include "PluginClientFactory.h" |
10 #include "PluginMutex.h" | 10 #include "PluginMutex.h" |
11 #include "sddl.h" | 11 #include "sddl.h" |
12 #include "PluginUtil.h" | 12 #include "PluginUtil.h" |
13 #include "PluginUserSettings.h" | 13 #include "PluginUserSettings.h" |
14 #include "../shared/Utils.h" | 14 #include "../shared/Utils.h" |
15 #include "../shared/Dictionary.h" | 15 #include "../shared/Dictionary.h" |
16 #include "WebBrowserEventsListener.h" | |
16 #include <thread> | 17 #include <thread> |
17 #include <array> | 18 #include <array> |
18 | 19 |
19 #ifdef DEBUG_HIDE_EL | 20 #ifdef DEBUG_HIDE_EL |
20 DWORD profileTime = 0; | 21 DWORD profileTime = 0; |
21 #endif | 22 #endif |
22 | 23 |
23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 24 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); | 25 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); |
25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 26 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 } | 65 } |
65 | 66 |
66 int Width() const | 67 int Width() const |
67 { | 68 { |
68 return right - left; | 69 return right - left; |
69 } | 70 } |
70 }; | 71 }; |
71 } | 72 } |
72 | 73 |
73 CPluginClass::CPluginClass() | 74 CPluginClass::CPluginClass() |
75 : m_data(std::make_shared<Data>()) | |
74 { | 76 { |
75 //Use this line to debug memory leaks | 77 //Use this line to debug memory leaks |
76 // _CrtDumpMemoryLeaks(); | 78 // _CrtDumpMemoryLeaks(); |
77 | 79 |
78 m_isAdviced = false; | 80 m_isAdviced = false; |
79 m_hTabWnd = NULL; | 81 m_hTabWnd = NULL; |
80 m_hStatusBarWnd = NULL; | 82 m_hStatusBarWnd = NULL; |
81 m_hPaneWnd = NULL; | 83 m_hPaneWnd = NULL; |
82 m_nPaneWidth = 0; | 84 m_nPaneWidth = 0; |
83 m_pWndProcStatus = NULL; | 85 m_pWndProcStatus = NULL; |
84 m_hTheme = NULL; | 86 m_hTheme = NULL; |
85 m_isInitializedOk = false; | 87 m_isInitializedOk = false; |
86 | 88 |
87 | 89 |
88 m_tab = new CPluginTab(this); | 90 m_data->tab.reset(new CPluginTab(this)); |
89 | |
90 Dictionary::Create(GetBrowserLanguage()); | 91 Dictionary::Create(GetBrowserLanguage()); |
91 } | 92 } |
92 | 93 |
93 CPluginClass::~CPluginClass() | 94 CPluginClass::~CPluginClass() |
94 { | 95 { |
95 delete m_tab; | |
96 } | 96 } |
97 | 97 |
98 | |
99 ///////////////////////////////////////////////////////////////////////////// | 98 ///////////////////////////////////////////////////////////////////////////// |
100 // Initialization | 99 // Initialization |
101 | 100 |
102 HRESULT CPluginClass::FinalConstruct() | 101 HRESULT CPluginClass::FinalConstruct() |
103 { | 102 { |
104 return S_OK; | 103 return S_OK; |
105 } | 104 } |
106 | 105 |
107 void CPluginClass::FinalRelease() | 106 void CPluginClass::FinalRelease() |
108 { | 107 { |
109 s_criticalSectionBrowser.Lock(); | 108 s_criticalSectionBrowser.Lock(); |
110 { | 109 { |
111 m_webBrowser2.Release(); | 110 m_data.reset(); |
112 } | 111 } |
113 s_criticalSectionBrowser.Unlock(); | 112 s_criticalSectionBrowser.Unlock(); |
114 } | 113 } |
115 | 114 |
116 HWND CPluginClass::GetBrowserHWND() const | 115 HWND CPluginClass::GetBrowserHWND() const |
117 { | 116 { |
118 SHANDLE_PTR hBrowserWndHandle = NULL; | 117 SHANDLE_PTR hBrowserWndHandle = NULL; |
119 | 118 |
120 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 119 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
121 if (browser) | 120 if (browser) |
122 { | 121 { |
123 HRESULT hr = browser->get_HWND(&hBrowserWndHandle); | 122 HRESULT hr = browser->get_HWND(&hBrowserWndHandle); |
124 if (FAILED(hr)) | 123 if (FAILED(hr)) |
125 { | 124 { |
126 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, " Class::GetBrowserHWND - failed") | 125 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, " Class::GetBrowserHWND - failed") |
127 } | 126 } |
128 } | 127 } |
129 | 128 |
130 return (HWND)hBrowserWndHandle; | 129 return (HWND)hBrowserWndHandle; |
131 } | 130 } |
132 | 131 |
133 | 132 |
134 CComQIPtr<IWebBrowser2> CPluginClass::GetBrowser() const | 133 CComQIPtr<IWebBrowser2> CPluginClass::GetBrowser() const |
135 { | 134 { |
136 CComQIPtr<IWebBrowser2> browser; | 135 CComQIPtr<IWebBrowser2> browser; |
137 | 136 |
138 s_criticalSectionBrowser.Lock(); | 137 s_criticalSectionBrowser.Lock(); |
139 { | 138 { |
140 browser = m_webBrowser2; | 139 browser = m_data->webBrowser2; |
141 } | 140 } |
142 s_criticalSectionBrowser.Unlock(); | 141 s_criticalSectionBrowser.Unlock(); |
143 | 142 |
144 return browser; | 143 return browser; |
145 } | 144 } |
146 | 145 |
147 | 146 |
148 CComQIPtr<IWebBrowser2> CPluginClass::GetAsyncBrowser() | 147 CComQIPtr<IWebBrowser2> CPluginClass::GetAsyncBrowser() |
149 { | 148 { |
150 CComQIPtr<IWebBrowser2> browser; | 149 CComQIPtr<IWebBrowser2> browser; |
(...skipping 17 matching lines...) Expand all Loading... | |
168 CComBSTR bstrURL; | 167 CComBSTR bstrURL; |
169 | 168 |
170 if (SUCCEEDED(browser->get_LocationURL(&bstrURL))) | 169 if (SUCCEEDED(browser->get_LocationURL(&bstrURL))) |
171 { | 170 { |
172 url = bstrURL; | 171 url = bstrURL; |
173 CPluginClient::UnescapeUrl(url); | 172 CPluginClient::UnescapeUrl(url); |
174 } | 173 } |
175 } | 174 } |
176 else | 175 else |
177 { | 176 { |
178 url = m_tab->GetDocumentUrl(); | 177 url = m_data->tab->GetDocumentUrl(); |
179 } | 178 } |
180 | 179 |
181 return url; | 180 return url; |
182 } | 181 } |
183 | 182 |
184 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) | 183 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) |
185 { | 184 { |
186 if (thisPtr == NULL) | 185 if (thisPtr == NULL) |
187 return 0; | 186 return 0; |
188 if (!((CPluginClass*)thisPtr)->InitObject(true)) | 187 if (!((CPluginClass*)thisPtr)->InitObject(true)) |
(...skipping 23 matching lines...) Expand all Loading... | |
212 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================") | 211 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================") |
213 | 212 |
214 HRESULT hr = ::CoInitialize(NULL); | 213 HRESULT hr = ::CoInitialize(NULL); |
215 if (FAILED(hr)) | 214 if (FAILED(hr)) |
216 { | 215 { |
217 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize"); | 216 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize"); |
218 } | 217 } |
219 | 218 |
220 s_criticalSectionBrowser.Lock(); | 219 s_criticalSectionBrowser.Lock(); |
221 { | 220 { |
222 m_webBrowser2 = unknownSite; | 221 m_data->webBrowser2 = ATL::CComQIPtr<IWebBrowser2>(unknownSite); |
223 } | 222 } |
224 s_criticalSectionBrowser.Unlock(); | 223 s_criticalSectionBrowser.Unlock(); |
225 | 224 |
226 //register the mimefilter | 225 //register the mimefilter |
227 //and only mimefilter | 226 //and only mimefilter |
228 //on some few computers the mimefilter does not get properly registered when it is done on another thread | 227 //on some few computers the mimefilter does not get properly registered when it is done on another thread |
229 | 228 |
230 s_criticalSectionLocal.Lock(); | 229 s_criticalSectionLocal.Lock(); |
231 { | 230 { |
232 // Always register on startup, then check if we need to unregister in a se parate thread | 231 // Always register on startup, then check if we need to unregister in a se parate thread |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 DEBUG_GENERAL("Loaded as toolbar handler"); | 268 DEBUG_GENERAL("Loaded as toolbar handler"); |
270 CComPtr<IServiceProvider> pServiceProvider; | 269 CComPtr<IServiceProvider> pServiceProvider; |
271 | 270 |
272 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); | 271 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); |
273 if (SUCCEEDED(hr)) | 272 if (SUCCEEDED(hr)) |
274 { | 273 { |
275 if (pServiceProvider) | 274 if (pServiceProvider) |
276 { | 275 { |
277 s_criticalSectionBrowser.Lock(); | 276 s_criticalSectionBrowser.Lock(); |
278 { | 277 { |
279 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2); | 278 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _data->webBrowser2); |
280 if (SUCCEEDED(hr)) | 279 if (SUCCEEDED(hr)) |
281 { | 280 { |
282 if (m_webBrowser2) | 281 if (m_data->webBrowser2) |
283 { | 282 { |
284 InitObject(false); | 283 InitObject(false); |
285 } | 284 } |
286 } | 285 } |
287 else | 286 else |
288 { | 287 { |
289 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE _QUERY_BROWSER, "Class::SetSite - QueryService (IID_IWebBrowserApp)"); | 288 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE _QUERY_BROWSER, "Class::SetSite - QueryService (IID_IWebBrowserApp)"); |
290 } | 289 } |
291 } | 290 } |
292 s_criticalSectionBrowser.Unlock(); | 291 s_criticalSectionBrowser.Unlock(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 if (s_instances.empty()) | 341 if (s_instances.empty()) |
343 { | 342 { |
344 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 343 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
345 } | 344 } |
346 } | 345 } |
347 s_criticalSectionLocal.Unlock(); | 346 s_criticalSectionLocal.Unlock(); |
348 | 347 |
349 // Release browser interface | 348 // Release browser interface |
350 s_criticalSectionBrowser.Lock(); | 349 s_criticalSectionBrowser.Lock(); |
351 { | 350 { |
352 m_webBrowser2.Release(); | 351 m_data->webBrowser2.Release(); |
353 } | 352 } |
354 s_criticalSectionBrowser.Unlock(); | 353 s_criticalSectionBrowser.Unlock(); |
355 | 354 |
356 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================") | 355 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================") |
357 | 356 |
358 ::CoUninitialize(); | 357 ::CoUninitialize(); |
359 } | 358 } |
360 | 359 |
361 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); | 360 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); |
362 } | 361 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 return; | 488 return; |
490 } | 489 } |
491 | 490 |
492 if (!urlVariant || urlVariant->vt != VT_BSTR) | 491 if (!urlVariant || urlVariant->vt != VT_BSTR) |
493 { | 492 { |
494 return; | 493 return; |
495 } | 494 } |
496 std::wstring url(V_BSTR(urlVariant), SysStringLen(V_BSTR(urlVariant))); | 495 std::wstring url(V_BSTR(urlVariant), SysStringLen(V_BSTR(urlVariant))); |
497 UnescapeUrl(url); | 496 UnescapeUrl(url); |
498 | 497 |
498 { | |
Oleksandr
2015/02/04 20:59:57
I would prefer for this to be a separate function
sergei
2015/04/13 08:06:58
I've extracted it into CPluginClass::EnsureWebBrow
sergei
2015/04/13 08:06:58
I guess here and below instead of CPluginClientFac
| |
499 auto it = m_data->connectedWebBrowsersCache.find(webBrowser); | |
500 if (m_data->connectedWebBrowsersCache.end() == it) | |
Oleksandr
2015/02/04 20:59:57
This is Yoda condition, IMO
sergei
2015/04/13 08:06:58
fixed
| |
501 { | |
502 ATL::CComObject<WebBrowserEventsListener>* listenerImpl = nullptr; | |
503 if (FAILED(ATL::CComObject<WebBrowserEventsListener>::CreateInstance(&list enerImpl))) | |
504 { | |
505 return; | |
506 } | |
507 ATL::CComPtr<IUnknown> listnerRefCounterGuard(listenerImpl->GetUnknown()); | |
Oleksandr
2015/02/04 20:59:57
missing 'e'? listenerRefCounterGuard
sergei
2015/04/13 08:06:58
fixed
| |
508 std::weak_ptr<Data> dataForCapturing = m_data; | |
509 auto onListenerDestroy = [webBrowser, dataForCapturing] | |
Oleksandr
2015/02/04 20:59:57
If this whole block is moved to CPluginClientFacto
sergei
2015/04/13 08:06:58
I think it will complicate the code because it is
| |
510 { | |
511 if (auto data = dataForCapturing.lock()) | |
512 { | |
513 data->connectedWebBrowsersCache.erase(webBrowser); | |
514 } | |
515 }; | |
516 if (FAILED(listenerImpl->Init(webBrowser, onListenerDestroy))) | |
517 { | |
518 return; | |
519 } | |
520 listenerImpl->reloaded = [webBrowser, dataForCapturing] | |
521 { | |
522 if (auto data = dataForCapturing.lock()) | |
523 { | |
524 auto frameSrc = GetLocationUrl(*webBrowser); | |
525 UnescapeUrl(frameSrc); | |
526 data->tab->OnDocumentComplete(webBrowser, ToCString(frameSrc), data->w ebBrowser2.IsEqualObject(webBrowser)); | |
527 } | |
528 }; | |
529 m_data->connectedWebBrowsersCache.emplace(webBrowser, listenerImpl); | |
530 } | |
531 } | |
532 | |
499 //Register a mime filter if it's not registered yet | 533 //Register a mime filter if it's not registered yet |
500 if (s_mimeFilter == NULL) | 534 if (s_mimeFilter == NULL) |
501 { | 535 { |
502 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); | 536 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
503 } | 537 } |
504 | 538 |
505 CString urlCString = ToCString(url); | 539 CString urlCString = ToCString(url); |
506 | 540 |
507 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page | 541 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page |
508 CPluginClient* client = CPluginClient::GetInstance(); | 542 CPluginClient* client = CPluginClient::GetInstance(); |
509 | 543 |
510 if (urlCString.Find(L"javascript") == 0) | 544 if (urlCString.Find(L"javascript") == 0) |
511 { | 545 { |
512 } | 546 } |
513 else if (GetBrowser().IsEqualObject(webBrowser)) | 547 else if (GetBrowser().IsEqualObject(webBrowser)) |
514 { | 548 { |
515 m_tab->OnNavigate(urlCString); | 549 m_data->tab->OnNavigate(urlCString); |
516 | 550 |
517 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + urlCString + "\n============ ====================================================================") | 551 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + urlCString + "\n============ ====================================================================") |
518 | 552 |
519 #ifdef ENABLE_DEBUG_RESULT | 553 #ifdef ENABLE_DEBUG_RESULT |
520 CPluginDebug::DebugResultDomain(urlCString); | 554 CPluginDebug::DebugResultDomain(urlCString); |
521 #endif | 555 #endif |
522 | 556 |
523 UpdateStatusBar(); | 557 UpdateStatusBar(); |
524 } | 558 } |
525 else | 559 else |
526 { | 560 { |
527 DEBUG_NAVI(L"Navi::Begin navigation url:" + urlCString) | 561 DEBUG_NAVI(L"Navi::Begin navigation url:" + urlCString) |
528 m_tab->CacheFrame(urlCString); | 562 m_data->tab->CacheFrame(urlCString); |
529 } | 563 } |
530 } | 564 } |
531 | 565 |
532 void STDMETHODCALLTYPE CPluginClass::OnDownloadBegin() | 566 void STDMETHODCALLTYPE CPluginClass::OnDownloadBegin() |
533 { | 567 { |
534 DEBUG_NAVI("Navi::Download Begin") | 568 DEBUG_NAVI("Navi::Download Begin") |
535 } | 569 } |
536 | 570 |
537 void STDMETHODCALLTYPE CPluginClass::OnDownloadComplete() | 571 void STDMETHODCALLTYPE CPluginClass::OnDownloadComplete() |
538 { | 572 { |
539 DEBUG_NAVI("Navi::Download Complete") | 573 DEBUG_NAVI("Navi::Download Complete") |
540 ATL::CComPtr<IWebBrowser2> browser = GetBrowser(); | 574 ATL::CComPtr<IWebBrowser2> browser = GetBrowser(); |
541 if (browser) | 575 if (browser) |
542 { | 576 { |
543 m_tab->OnDownloadComplete(browser); | 577 m_data->tab->OnDownloadComplete(browser); |
544 } | 578 } |
545 } | 579 } |
546 | 580 |
547 void STDMETHODCALLTYPE CPluginClass::OnDocumentComplete(IDispatch* frameBrowserD isp, VARIANT* /*urlOrPidl*/) | 581 void STDMETHODCALLTYPE CPluginClass::OnDocumentComplete(IDispatch* frameBrowserD isp, VARIANT* /*urlOrPidl*/) |
548 { | 582 { |
549 ATL::CComQIPtr<IWebBrowser2> webBrowser2 = frameBrowserDisp; | |
550 if (!webBrowser2) | |
551 { | |
552 return; | |
553 } | |
554 ATL::CString frameSrc; | |
555 ATL::CComBSTR locationUrl; | |
556 if (FAILED(webBrowser2->get_LocationURL(&locationUrl)) && !!locationUrl) | |
557 { | |
558 return; | |
559 } | |
560 frameSrc = locationUrl; | |
561 CPluginClient::UnescapeUrl(frameSrc); | |
562 bool isRootPageBrowser = GetBrowser().IsEqualObject(webBrowser2); | |
563 m_tab->OnDocumentComplete(webBrowser2, frameSrc, isRootPageBrowser); | |
564 } | 583 } |
565 | 584 |
566 void STDMETHODCALLTYPE CPluginClass::OnWindowStateChanged(unsigned long flags, u nsigned long validFlagsMask) | 585 void STDMETHODCALLTYPE CPluginClass::OnWindowStateChanged(unsigned long flags, u nsigned long validFlagsMask) |
567 { | 586 { |
568 DEBUG_GENERAL("Tab changed"); | 587 DEBUG_GENERAL("Tab changed"); |
569 bool newtabshown = validFlagsMask == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLEC MDIDF_WINDOWSTATE_ENABLED) | 588 bool newtabshown = validFlagsMask == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLEC MDIDF_WINDOWSTATE_ENABLED) |
570 && flags == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLECMDIDF_WIN DOWSTATE_ENABLED); | 589 && flags == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLECMDIDF_WIN DOWSTATE_ENABLED); |
571 if (newtabshown) | 590 if (newtabshown) |
572 { | 591 { |
573 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); | 592 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 } | 975 } |
957 } | 976 } |
958 } | 977 } |
959 s_criticalSectionLocal.Unlock(); | 978 s_criticalSectionLocal.Unlock(); |
960 | 979 |
961 return result; | 980 return result; |
962 } | 981 } |
963 | 982 |
964 CPluginTab* CPluginClass::GetTab() | 983 CPluginTab* CPluginClass::GetTab() |
965 { | 984 { |
966 return m_tab; | 985 return m_data->tab.get(); |
967 } | 986 } |
968 | 987 |
969 CPluginTab* CPluginClass::GetTab(DWORD dwThreadId) | 988 CPluginTab* CPluginClass::GetTab(DWORD dwThreadId) |
970 { | 989 { |
971 CPluginTab* tab = NULL; | 990 CPluginTab* tab = NULL; |
972 | 991 |
973 s_criticalSectionLocal.Lock(); | 992 s_criticalSectionLocal.Lock(); |
974 { | 993 { |
975 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(dw ThreadId); | 994 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(dw ThreadId); |
976 if (it != s_threadInstances.end()) | 995 if (it != s_threadInstances.end()) |
977 { | 996 { |
978 tab = it->second->m_tab; | 997 tab = it->second->m_data->tab.get(); |
979 } | 998 } |
980 } | 999 } |
981 s_criticalSectionLocal.Unlock(); | 1000 s_criticalSectionLocal.Unlock(); |
982 | 1001 |
983 return tab; | 1002 return tab; |
984 } | 1003 } |
985 | 1004 |
986 | 1005 |
987 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) | 1006 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) |
988 { | 1007 { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1203 | 1222 |
1204 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) | 1223 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) |
1205 { | 1224 { |
1206 HWND hBrowserWnd = GetBrowserHWND(); | 1225 HWND hBrowserWnd = GetBrowserHWND(); |
1207 if (!hBrowserWnd) | 1226 if (!hBrowserWnd) |
1208 { | 1227 { |
1209 return E_FAIL; | 1228 return E_FAIL; |
1210 } | 1229 } |
1211 | 1230 |
1212 // Create menu | 1231 // Create menu |
1213 HMENU hMenu = CreatePluginMenu(m_tab->GetDocumentUrl()); | 1232 HMENU hMenu = CreatePluginMenu(m_data->tab->GetDocumentUrl()); |
1214 if (!hMenu) | 1233 if (!hMenu) |
1215 { | 1234 { |
1216 return E_FAIL; | 1235 return E_FAIL; |
1217 } | 1236 } |
1218 | 1237 |
1219 // Check if button in toolbar was pressed | 1238 // Check if button in toolbar was pressed |
1220 int nIDCommand = -1; | 1239 int nIDCommand = -1; |
1221 BOOL bRightAlign = FALSE; | 1240 BOOL bRightAlign = FALSE; |
1222 | 1241 |
1223 POINT pt; | 1242 POINT pt; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1712 } | 1731 } |
1713 } | 1732 } |
1714 } | 1733 } |
1715 | 1734 |
1716 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1735 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1717 } | 1736 } |
1718 | 1737 |
1719 return hTabWnd; | 1738 return hTabWnd; |
1720 | 1739 |
1721 } | 1740 } |
OLD | NEW |