OLD | NEW |
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 Loading... |
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 » bool handled = false; |
366 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); | 366 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); |
367 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, | 367 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, |
368 dwReserved, pTargetProtocol, handled); | 368 dwReserved, pTargetProtocol, handled); |
369 | 369 |
370 CComPtr<IInternetProtocolSink> spSink; | 370 CComPtr<IInternetProtocolSink> spSink; |
371 CComPtr<IInternetBindInfo> spBindInfo; | 371 CComPtr<IInternetBindInfo> spBindInfo; |
372 if (SUCCEEDED(hr)) | 372 if (SUCCEEDED(hr)) |
373 { | 373 { |
374 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink, | 374 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpre
t_cast<void**>(&spSink)); |
375 » » » reinterpret_cast<void**>(&spSink)); | |
376 ATLASSERT(SUCCEEDED(hr) && spSink != 0); | 375 ATLASSERT(SUCCEEDED(hr) && spSink != 0); |
377 } | 376 } |
378 if (SUCCEEDED(hr)) | 377 if (SUCCEEDED(hr)) |
379 { | 378 { |
380 » » hr = pSink->QueryInterface(IID_IInternetBindInfo, | 379 » » hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_ca
st<void**>(&spBindInfo)); |
381 » » » reinterpret_cast<void**>(&spBindInfo)); | |
382 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); | 380 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); |
383 } | 381 } |
384 if (SUCCEEDED(hr) && !handled) | 382 if (SUCCEEDED(hr) && !handled) |
385 { | 383 { |
386 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, | 384 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dw
Reserved); |
387 » » » dwReserved); | 385 » » static_cast<Protocol*>(this)->m_hasOriginalStartCalled = true; |
| 386 » } |
| 387 » if (E_ABORT == hr && pSink->m_blockedInTransaction) |
| 388 » { |
| 389 » » static_cast<Protocol*>(this)->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; |
388 } | 393 } |
389 return hr; | 394 return hr; |
390 } | 395 } |
391 | 396 |
392 | 397 |
393 template <class Protocol, class Sink> | 398 template <class Protocol, class Sink> |
394 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink( | 399 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink( |
395 const Protocol* pProtocol) | 400 const Protocol* pProtocol) |
396 { | 401 { |
397 return Protocol::ComObjectClass::GetSink(pProtocol); | 402 return Protocol::ComObjectClass::GetSink(pProtocol); |
398 } | 403 } |
399 | 404 |
400 template <class Protocol, class Sink> | 405 template <class Protocol, class Sink> |
401 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const | 406 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const |
402 { | 407 { |
403 return GetSink(static_cast<const Protocol*>(this)); | 408 return GetSink(static_cast<const Protocol*>(this)); |
404 } | 409 } |
405 | 410 |
406 template <class Protocol, class Sink> | 411 template <class Protocol, class Sink> |
407 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( | 412 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( |
408 const Sink* pSink) | 413 const Sink* pSink) |
409 { | 414 { |
410 return Protocol::ComObjectClass::GetProtocol(pSink); | 415 return Protocol::ComObjectClass::GetProtocol(pSink); |
411 } | 416 } |
412 | 417 |
413 } // end namespace PassthroughAPP | 418 } // end namespace PassthroughAPP |
414 | 419 |
415 #endif // PASSTHROUGHAPP_SINKPOLICY_INL | 420 #endif // PASSTHROUGHAPP_SINKPOLICY_INL |
OLD | NEW |