Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginDomTraverserBase.h

Issue 5070706781978624: Issue #276 - introduce class BSTR_Argument (Closed)
Patch Set: Created July 25, 2014, 9:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "COM_Value.h"
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 #include "PluginTab.h" 6 #include "PluginTab.h"
7 7
8
9 class CPluginDomTraverserCacheBase 8 class CPluginDomTraverserCacheBase
10 { 9 {
11 public: 10 public:
12 11
13 long m_elements; 12 long m_elements;
14 13
15 CPluginDomTraverserCacheBase() : m_elements(0) {}; 14 CPluginDomTraverserCacheBase() : m_elements(0) {};
16 void Init() { m_elements=0; } 15 void Init() { m_elements=0; }
17 }; 16 };
18 17
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 { 214 {
216 CComVariant vIndex(i); 215 CComVariant vIndex(i);
217 CComVariant vRetIndex; 216 CComVariant vRetIndex;
218 CComPtr<IDispatch> pFrameDispatch; 217 CComPtr<IDispatch> pFrameDispatch;
219 218
220 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch) 219 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch)
221 { 220 {
222 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 221 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
223 if (pFrameBrowser) 222 if (pFrameBrowser)
224 { 223 {
225 CComBSTR bstrSrc;
226 CString src; 224 CString src;
227 225 AdblockPlus::COM::BSTR_Argument result;
228 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc))) 226 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&result)))
229 { 227 {
230 src = bstrSrc; 228 src = to_CString(result);
231 CPluginClient::UnescapeUrl(src); 229 CPluginClient::UnescapeUrl(src);
232 } 230 }
233 231
234 if (!src.IsEmpty()) 232 if (!src.IsEmpty())
235 { 233 {
236 TraverseDocument(pFrameBrowser, false, indent); 234 TraverseDocument(pFrameBrowser, false, indent);
237 } 235 }
238 } 236 }
239 } 237 }
240 } 238 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 363 }
366 364
367 // Update cache 365 // Update cache
368 m_criticalSection.Lock(); 366 m_criticalSection.Lock();
369 { 367 {
370 m_cacheElements[cacheIndex].m_elements = allElementsCount; 368 m_cacheElements[cacheIndex].m_elements = allElementsCount;
371 } 369 }
372 m_criticalSection.Unlock(); 370 m_criticalSection.Unlock();
373 371
374 // Get tag 372 // Get tag
375 CComBSTR bstrTag; 373 AdblockPlus::COM::BSTR_Argument result;
376 if (FAILED(pEl->get_tagName(&bstrTag)) || !bstrTag) 374 if (FAILED(pEl->get_tagName(&result)) || !result.operator std::wstring().empty ())
377 { 375 {
378 return; 376 return;
379 } 377 }
380 378
381 CString tag = bstrTag; 379 CString tag = to_CString(result);
382 tag.MakeLower(); 380 tag.MakeLower();
383 381
384 // Custom OnElement 382 // Custom OnElement
385 if (!OnElement(pEl, tag, &m_cacheElements[cacheIndex], false, indent)) 383 if (!OnElement(pEl, tag, &m_cacheElements[cacheIndex], false, indent))
386 { 384 {
387 return; 385 return;
388 } 386 }
389 387
390 // Update frame/iframe cache 388 // Update frame/iframe cache
391 if (tag == "iframe") 389 if (tag == "iframe")
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (tab->m_plugin->GetTabHWND() == NULL) 458 if (tab->m_plugin->GetTabHWND() == NULL)
461 { 459 {
462 return; 460 return;
463 } 461 }
464 462
465 463
466 } 464 }
467 465
468 466
469 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ 467 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld