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

Delta Between Two Patch Sets: src/plugin/PluginDomTraverserBase.h

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Left Patch Set: Created Oct. 21, 2014, 5:18 p.m.
Right Patch Set: Created Jan. 5, 2015, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 13 matching lines...) Expand all
24 24
25 CPluginDomTraverserBase(CPluginTab* tab); 25 CPluginDomTraverserBase(CPluginTab* tab);
26 ~CPluginDomTraverserBase(); 26 ~CPluginDomTraverserBase();
27 27
28 void TraverseHeader(bool isHeaderTraversed); 28 void TraverseHeader(bool isHeaderTraversed);
29 29
30 void TraverseDocument(IWebBrowser2* pBrowser, const std::wstring& domain, cons t std::wstring& documentName); 30 void TraverseDocument(IWebBrowser2* pBrowser, const std::wstring& domain, cons t std::wstring& documentName);
31 void TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain, c onst CString& documentName); 31 void TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain, c onst CString& documentName);
32 32
33 virtual void ClearCache(); 33 virtual void ClearCache();
34
35 void ShowNotification(CPluginTab* tab);
36 34
37 protected: 35 protected:
38 36
39 virtual bool OnIFrame(IHTMLElement* pEl, const std::wstring& url, CString& ind ent) { return true; } 37 virtual bool OnIFrame(IHTMLElement* pEl, const std::wstring& url, CString& ind ent) { return true; }
40 virtual bool OnElement(IHTMLElement* pEl, const CString& tag, T* cache, bool i sDebug, CString& indent) { return true; } 38 virtual bool OnElement(IHTMLElement* pEl, const CString& tag, T* cache, bool i sDebug, CString& indent) { return true; }
41 39
42 virtual bool IsEnabled(); 40 virtual bool IsEnabled();
43 41
44 protected: 42 protected:
45 43
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 { 213 {
216 CComVariant vIndex(i); 214 CComVariant vIndex(i);
217 CComVariant vRetIndex; 215 CComVariant vRetIndex;
218 CComPtr<IDispatch> pFrameDispatch; 216 CComPtr<IDispatch> pFrameDispatch;
219 217
220 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch) 218 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch)
221 { 219 {
222 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 220 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
223 if (pFrameBrowser) 221 if (pFrameBrowser)
224 { 222 {
225 BSTR bstrSrc;
226 std::wstring src; 223 std::wstring src;
227 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc))) 224 CComBSTR bstrSrc;
225 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc)) && bstrSrc)
228 { 226 {
229 src = std::wstring(bstrSrc,SysStringLen(bstrSrc)); 227 src = std::wstring(bstrSrc,SysStringLen(bstrSrc));
230 SysFreeString(bstrSrc);
231 UnescapeUrl(src); 228 UnescapeUrl(src);
232 } 229 }
233 if (!src.empty()) 230 if (!src.empty())
234 { 231 {
235 TraverseDocument(pFrameBrowser, false, indent); 232 TraverseDocument(pFrameBrowser, false, indent);
236 } 233 }
237 } 234 }
238 } 235 }
239 } 236 }
240 } 237 }
(...skipping 29 matching lines...) Expand all
270 // Some times, domain is missing. Should this be added on image src' s as well?'' 267 // Some times, domain is missing. Should this be added on image src' s as well?''
271 268
272 // eg. gadgetzone.com.au 269 // eg. gadgetzone.com.au
273 if (srcLegacy.Left(2) == L"//") 270 if (srcLegacy.Left(2) == L"//")
274 { 271 {
275 srcLegacy = L"http:" + srcLegacy; 272 srcLegacy = L"http:" + srcLegacy;
276 } 273 }
277 // eg. http://w3schools.com/html/html_examples.asp 274 // eg. http://w3schools.com/html/html_examples.asp
278 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res: //") 275 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res: //")
279 { 276 {
280 srcLegacy = L"http://" + to_CString(m_domain) + srcLegacy; 277 srcLegacy = L"http://" + to_CString(m_domain) + srcLegacy;
sergei 2015/01/06 13:18:18 should ToCString be instead of to_CString here?
Eric 2015/01/06 19:38:59 It's time to do a wholesale replacement, which was
Oleksandr 2015/01/13 10:08:06 Would be great to not commit to_CString anyway tho
281 } 278 }
282 std::wstring src(ToWstring(srcLegacy)); 279 std::wstring src(ToWstring(srcLegacy));
283 UnescapeUrl(src); 280 UnescapeUrl(src);
284 281
285 // Check if Iframe should be traversed 282 // Check if Iframe should be traversed
286 if (OnIFrame(pFrameEl, src, indent)) 283 if (OnIFrame(pFrameEl, src, indent))
287 { 284 {
288 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 285 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
289 if (pFrameBrowser) 286 if (pFrameBrowser)
290 { 287 {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 void CPluginDomTraverserBase<T>::ClearCache() 443 void CPluginDomTraverserBase<T>::ClearCache()
447 { 444 {
448 m_criticalSection.Lock(); 445 m_criticalSection.Lock();
449 { 446 {
450 m_cacheIndexLast = 0; 447 m_cacheIndexLast = 0;
451 m_cacheDocumentHasFrames.clear(); 448 m_cacheDocumentHasFrames.clear();
452 m_cacheDocumentHasIframes.clear(); 449 m_cacheDocumentHasIframes.clear();
453 } 450 }
454 m_criticalSection.Unlock(); 451 m_criticalSection.Unlock();
455 } 452 }
456 template <class T>
457 void CPluginDomTraverserBase<T>::ShowNotification(CPluginTab* tab)
458 {
459 if (tab->m_plugin->GetTabHWND() == NULL)
460 {
461 return;
462 }
463
464
465 }
466 453
467 454
468 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ 455 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld