OLD | NEW |
1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_ | 1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_ |
2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_ | 2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_ |
3 | 3 |
4 | 4 |
5 #include "PluginTypedef.h" | 5 #include "PluginTypedef.h" |
6 #include "PluginTab.h" | 6 #include "PluginTab.h" |
7 | 7 |
8 | 8 |
9 class CPluginDomTraverserCacheBase | 9 class CPluginDomTraverserCacheBase |
10 { | 10 { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return CPluginSettings::GetInstance()->IsPluginEnabled(); | 109 return CPluginSettings::GetInstance()->IsPluginEnabled(); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 template <class T> | 113 template <class T> |
114 void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool i
sMainDoc, CString indent) | 114 void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool i
sMainDoc, CString indent) |
115 { | 115 { |
116 DWORD res = WaitForSingleObject(m_tab->m_filter->hideFiltersLoadedEvent, ENGIN
E_STARTUP_TIMEOUT); | 116 DWORD res = WaitForSingleObject(m_tab->m_filter->hideFiltersLoadedEvent, ENGIN
E_STARTUP_TIMEOUT); |
117 if (!IsEnabled()) return; | 117 if (!IsEnabled()) return; |
118 | 118 |
119 VARIANT_BOOL isBusy; | 119 VARIANT_BOOL isBusy; |
120 if (SUCCEEDED(pBrowser->get_Busy(&isBusy))) | 120 if (SUCCEEDED(pBrowser->get_Busy(&isBusy))) |
121 { | 121 { |
122 if (isBusy) | 122 if (isBusy) |
123 { | 123 { |
124 return; | 124 return; |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 // Get document | 128 // Get document |
129 CComPtr<IDispatch> pDocDispatch; | 129 CComPtr<IDispatch> pDocDispatch; |
(...skipping 22 matching lines...) Expand all Loading... |
152 pBodyEl = pBody; | 152 pBodyEl = pBody; |
153 } | 153 } |
154 else | 154 else |
155 { | 155 { |
156 CComPtr<IHTMLElementCollection> pBodyCollection; | 156 CComPtr<IHTMLElementCollection> pBodyCollection; |
157 if (FAILED(pDoc->getElementsByTagName(L"body", &pBodyCollection)) || !pBodyC
ollection) | 157 if (FAILED(pDoc->getElementsByTagName(L"body", &pBodyCollection)) || !pBodyC
ollection) |
158 { | 158 { |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 CComVariant vIndex(0); | 162 CComVariant vIndex(0); |
163 CComPtr<IDispatch> pBodyDispatch; | 163 CComPtr<IDispatch> pBodyDispatch; |
164 if (FAILED(pBodyCollection->item(vIndex, vIndex, &pBodyDispatch)) || !pBodyD
ispatch) | 164 if (FAILED(pBodyCollection->item(vIndex, vIndex, &pBodyDispatch)) || !pBodyD
ispatch) |
165 { | 165 { |
166 return; | 166 return; |
167 } | 167 } |
168 | 168 |
169 if (FAILED(pBodyDispatch->QueryInterface(IID_IHTMLElement, (LPVOID*)&pBodyEl
)) || !pBodyEl) | 169 if (FAILED(pBodyDispatch->QueryInterface(IID_IHTMLElement, (LPVOID*)&pBodyEl
)) || !pBodyEl) |
170 { | 170 { |
171 return; | 171 return; |
172 } | 172 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 CPluginClient::UnescapeUrl(src); | 282 CPluginClient::UnescapeUrl(src); |
283 | 283 |
284 // Check if Iframe should be traversed | 284 // Check if Iframe should be traversed |
285 if (OnIFrame(pFrameEl, src, indent)) | 285 if (OnIFrame(pFrameEl, src, indent)) |
286 { | 286 { |
287 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; | 287 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; |
288 if (pFrameBrowser) | 288 if (pFrameBrowser) |
289 { | 289 { |
290 TraverseDocument(pFrameBrowser, false, indent); | 290 TraverseDocument(pFrameBrowser, false, indent); |
291 } | 291 } |
292 } | 292 }» |
293 } | 293 } |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 template <class T> | 301 template <class T> |
302 void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2*
pBrowser, CString& indent, bool isCached) | 302 void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2*
pBrowser, CString& indent, bool isCached) |
(...skipping 20 matching lines...) Expand all Loading... |
323 if (cacheIndex >= m_cacheElementsMax) | 323 if (cacheIndex >= m_cacheElementsMax) |
324 { | 324 { |
325 T* oldCacheElements = m_cacheElements; | 325 T* oldCacheElements = m_cacheElements; |
326 | 326 |
327 m_cacheElements = new T[2*m_cacheElementsMax]; | 327 m_cacheElements = new T[2*m_cacheElementsMax]; |
328 | 328 |
329 memcpy(m_cacheElements, oldCacheElements, m_cacheElementsMax*sizeof(T)); | 329 memcpy(m_cacheElements, oldCacheElements, m_cacheElementsMax*sizeof(T)); |
330 | 330 |
331 m_cacheElementsMax *= 2; | 331 m_cacheElementsMax *= 2; |
332 | 332 |
333 delete [] oldCacheElements; | 333 delete [] oldCacheElements; |
334 } | 334 } |
335 | 335 |
336 m_cacheElements[cacheIndex].Init(); | 336 m_cacheElements[cacheIndex].Init(); |
337 | 337 |
338 vCacheIndex.vt = VT_I4; | 338 vCacheIndex.vt = VT_I4; |
339 vCacheIndex.intVal = cacheIndex; | 339 vCacheIndex.intVal = cacheIndex; |
340 | 340 |
341 pEl->setAttribute(L"abp", vCacheIndex); | 341 pEl->setAttribute(L"abp", vCacheIndex); |
342 } | 342 } |
343 } | 343 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 { | 448 { |
449 m_cacheIndexLast = 0; | 449 m_cacheIndexLast = 0; |
450 m_cacheDocumentHasFrames.clear(); | 450 m_cacheDocumentHasFrames.clear(); |
451 m_cacheDocumentHasIframes.clear(); | 451 m_cacheDocumentHasIframes.clear(); |
452 } | 452 } |
453 m_criticalSection.Unlock(); | 453 m_criticalSection.Unlock(); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ | 457 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ |
OLD | NEW |