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

Side by Side Diff: src/plugin/SinkPolicy.inl

Issue 6299667012780032: Issues #696,1231,1264,1265 - Improve handling in PassthroughApp (Closed)
Patch Set: Created Sept. 19, 2014, 2:41 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
« src/plugin/PluginWbPassThrough.cpp ('K') | « src/plugin/SinkPolicy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef PASSTHROUGHAPP_SINKPOLICY_INL 1 #ifndef PASSTHROUGHAPP_SINKPOLICY_INL
2 #define PASSTHROUGHAPP_SINKPOLICY_INL 2 #define PASSTHROUGHAPP_SINKPOLICY_INL
3 3
4 #if _MSC_VER > 1000 4 #if _MSC_VER > 1000
5 #pragma once 5 #pragma once
6 #endif // _MSC_VER > 1000 6 #endif // _MSC_VER > 1000
7 7
8 #ifndef PASSTHROUGHAPP_SINKPOLICY_H 8 #ifndef PASSTHROUGHAPP_SINKPOLICY_H
9 #error SinkPolicy.inl requires SinkPolicy.h to be included first 9 #error SinkPolicy.inl requires SinkPolicy.h to be included first
10 #endif 10 #endif
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 static_cast<const CComObjectProtSink*>(pProtocolObject)); 351 static_cast<const CComObjectProtSink*>(pProtocolObject));
352 return pThis->m_sink.GetContainedObject(); 352 return pThis->m_sink.GetContainedObject();
353 } 353 }
354 354
355 // ===== CustomSinkStartPolicy ===== 355 // ===== CustomSinkStartPolicy =====
356 356
357 template <class Protocol, class Sink> 357 template <class Protocol, class Sink>
358 inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl, 358 inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl,
359 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, 359 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
360 DWORD grfPI, HANDLE_PTR dwReserved, 360 DWORD grfPI, HANDLE_PTR dwReserved,
361 » IInternetProtocol* pTargetProtocol) const 361 » IInternetProtocol* pTargetProtocol)
362 { 362 {
363 ATLASSERT(pTargetProtocol != 0); 363 ATLASSERT(pTargetProtocol != 0);
364 364
365 bool handled = false;
365 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); 366 Sink* pSink = GetSink(static_cast<const Protocol*>(this));
366 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, 367 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,
367 » » dwReserved, pTargetProtocol); 368 » » dwReserved, pTargetProtocol, handled);
368 369
369 CComPtr<IInternetProtocolSink> spSink; 370 CComPtr<IInternetProtocolSink> spSink;
370 CComPtr<IInternetBindInfo> spBindInfo; 371 CComPtr<IInternetBindInfo> spBindInfo;
371 if (SUCCEEDED(hr)) 372 if (SUCCEEDED(hr))
372 { 373 {
373 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink, 374 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpre t_cast<void**>(&spSink));
374 » » » reinterpret_cast<void**>(&spSink));
375 ATLASSERT(SUCCEEDED(hr) && spSink != 0); 375 ATLASSERT(SUCCEEDED(hr) && spSink != 0);
376 } 376 }
377 if (SUCCEEDED(hr)) 377 if (SUCCEEDED(hr))
378 { 378 {
379 » » hr = pSink->QueryInterface(IID_IInternetBindInfo, 379 » » hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_ca st<void**>(&spBindInfo));
380 » » » reinterpret_cast<void**>(&spBindInfo));
381 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); 380 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0);
382 } 381 }
383 » if (SUCCEEDED(hr)) 382 » if (SUCCEEDED(hr) && !handled)
384 { 383 {
385 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, 384 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dw Reserved);
386 » » » dwReserved); 385 » » static_cast<Protocol*>(this)->m_hasOriginalStartCalled = true;
386 » }
387 » if (E_ABORT == hr && pSink->m_blockedInTransaction)
388 » {
389 » » PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink >::GetProtocol(pSink)->m_shouldSupplyCustomContent = true;
390 » » pSink->m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMET YPEAVAILABLE, L"text/html");
391 » » pSink->m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFI CATION, 0, static_cast<ULONG>(g_blockedByABPPage.size()));
392 » » return S_OK;
387 } 393 }
388 return hr; 394 return hr;
389 } 395 }
390 396
391 397
392 template <class Protocol, class Sink> 398 template <class Protocol, class Sink>
393 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink( 399 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink(
394 const Protocol* pProtocol) 400 const Protocol* pProtocol)
395 { 401 {
396 return Protocol::ComObjectClass::GetSink(pProtocol); 402 return Protocol::ComObjectClass::GetSink(pProtocol);
397 } 403 }
398 404
399 template <class Protocol, class Sink> 405 template <class Protocol, class Sink>
400 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const 406 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const
401 { 407 {
402 return GetSink(static_cast<const Protocol*>(this)); 408 return GetSink(static_cast<const Protocol*>(this));
403 } 409 }
404 410
405 template <class Protocol, class Sink> 411 template <class Protocol, class Sink>
406 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( 412 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol(
407 const Sink* pSink) 413 const Sink* pSink)
408 { 414 {
409 return Protocol::ComObjectClass::GetProtocol(pSink); 415 return Protocol::ComObjectClass::GetProtocol(pSink);
410 } 416 }
411 417
412 } // end namespace PassthroughAPP 418 } // end namespace PassthroughAPP
413 419
414 #endif // PASSTHROUGHAPP_SINKPOLICY_INL 420 #endif // PASSTHROUGHAPP_SINKPOLICY_INL
OLDNEW
« src/plugin/PluginWbPassThrough.cpp ('K') | « src/plugin/SinkPolicy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld