OLD | NEW |
1 // Copyright 2007 Igor Tandetnik | 1 // Copyright 2007 Igor Tandetnik |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ATLASSERT(pOIBindInfo != 0); | 465 ATLASSERT(pOIBindInfo != 0); |
466 ATLASSERT(pTargetProtocol != 0); | 466 ATLASSERT(pTargetProtocol != 0); |
467 if (!pOIProtSink || !pOIBindInfo || !pTargetProtocol) | 467 if (!pOIProtSink || !pOIBindInfo || !pTargetProtocol) |
468 { | 468 { |
469 return E_POINTER; | 469 return E_POINTER; |
470 } | 470 } |
471 | 471 |
472 // This method should only be called once, and be the only source | 472 // This method should only be called once, and be the only source |
473 // of target interface pointers. | 473 // of target interface pointers. |
474 ATLASSERT(m_spInternetProtocolSink == 0); | 474 ATLASSERT(m_spInternetProtocolSink == 0); |
475 ATLASSERT(m_spInternetBindInfo == 0); | |
476 ATLASSERT(m_spTargetProtocol == 0); | 475 ATLASSERT(m_spTargetProtocol == 0); |
477 if (m_spInternetProtocolSink || m_spInternetBindInfo || m_spTargetProtocol) | 476 if (m_spInternetProtocolSink || m_spTargetProtocol) |
478 { | 477 { |
479 return E_UNEXPECTED; | 478 return E_UNEXPECTED; |
480 } | 479 } |
481 | 480 |
482 ATLASSERT(m_spServiceProvider == 0); | 481 ATLASSERT(m_spServiceProvider == 0); |
483 | 482 |
484 m_spInternetProtocolSink = pOIProtSink; | 483 m_spInternetProtocolSink = pOIProtSink; |
485 m_spInternetBindInfo = pOIBindInfo; | |
486 m_spTargetProtocol = pTargetProtocol; | 484 m_spTargetProtocol = pTargetProtocol; |
487 return S_OK; | 485 return S_OK; |
488 } | 486 } |
489 | 487 |
490 inline void IInternetProtocolSinkImpl::ReleaseAll() | 488 inline void IInternetProtocolSinkImpl::ReleaseAll() |
491 { | 489 { |
492 m_spInternetProtocolSink.Release(); | 490 m_spInternetProtocolSink.Release(); |
493 m_spServiceProvider.Release(); | 491 m_spServiceProvider.Release(); |
494 m_spInternetBindInfo.Release(); | |
495 m_spTargetProtocol.Release(); | 492 m_spTargetProtocol.Release(); |
496 } | 493 } |
497 | 494 |
498 inline IServiceProvider* IInternetProtocolSinkImpl::GetClientServiceProvider() | 495 inline IServiceProvider* IInternetProtocolSinkImpl::GetClientServiceProvider() |
499 { | 496 { |
500 return m_spServiceProvider; | 497 return m_spServiceProvider; |
501 } | 498 } |
502 | 499 |
503 inline HRESULT IInternetProtocolSinkImpl::QueryServiceFromClient( | 500 inline HRESULT IInternetProtocolSinkImpl::QueryServiceFromClient( |
504 REFGUID guidService, REFIID riid, void** ppvObject) | 501 REFGUID guidService, REFIID riid, void** ppvObject) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 /* [in] */ REFGUID guidService, | 576 /* [in] */ REFGUID guidService, |
580 /* [in] */ REFIID riid, | 577 /* [in] */ REFIID riid, |
581 /* [out] */ void** ppvObject) | 578 /* [out] */ void** ppvObject) |
582 { | 579 { |
583 ATLASSERT(m_spServiceProvider != 0); | 580 ATLASSERT(m_spServiceProvider != 0); |
584 return m_spServiceProvider ? | 581 return m_spServiceProvider ? |
585 m_spServiceProvider->QueryService(guidService, riid, ppvObject) : | 582 m_spServiceProvider->QueryService(guidService, riid, ppvObject) : |
586 E_UNEXPECTED; | 583 E_UNEXPECTED; |
587 } | 584 } |
588 | 585 |
589 // IInternetBindInfo | |
590 inline STDMETHODIMP IInternetProtocolSinkImpl::GetBindInfo( | |
591 /* [out] */ DWORD *grfBINDF, | |
592 /* [in, out] */ BINDINFO *pbindinfo) | |
593 { | |
594 ATLASSERT(m_spInternetBindInfo != 0); | |
595 return m_spInternetBindInfo ? | |
596 m_spInternetBindInfo->GetBindInfo(grfBINDF, pbindinfo) : | |
597 E_UNEXPECTED; | |
598 } | |
599 | |
600 inline STDMETHODIMP IInternetProtocolSinkImpl::GetBindString( | |
601 /* [in] */ ULONG ulStringType, | |
602 /* [in, out] */ LPOLESTR *ppwzStr, | |
603 /* [in] */ ULONG cEl, | |
604 /* [in, out] */ ULONG *pcElFetched) | |
605 { | |
606 ATLASSERT(m_spInternetBindInfo != 0); | |
607 return m_spInternetBindInfo ? | |
608 m_spInternetBindInfo->GetBindString(ulStringType, ppwzStr, cEl, | |
609 pcElFetched) : | |
610 E_UNEXPECTED; | |
611 } | |
612 | |
613 // ===== CInternetProtocolSinkWithSP ===== | 586 // ===== CInternetProtocolSinkWithSP ===== |
614 | 587 |
615 template <class T, class ThreadModel> | 588 template <class T, class ThreadModel> |
616 inline HRESULT CInternetProtocolSinkWithSP<T, ThreadModel>::OnStart( | 589 inline HRESULT CInternetProtocolSinkWithSP<T, ThreadModel>::OnStart( |
617 LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, | 590 LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, |
618 IInternetBindInfo *pOIBindInfo, DWORD grfPI, DWORD dwReserved, | 591 IInternetBindInfo *pOIBindInfo, DWORD grfPI, DWORD dwReserved, |
619 IInternetProtocol* pTargetProtocol) | 592 IInternetProtocol* pTargetProtocol) |
620 { | 593 { |
621 ATLASSERT(m_spServiceProvider == 0); | 594 ATLASSERT(m_spServiceProvider == 0); |
622 if (m_spServiceProvider) | 595 if (m_spServiceProvider) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 ATLASSERT(pTargetProtocol); | 697 ATLASSERT(pTargetProtocol); |
725 HRESULT hr = m_internetSink.OnStart(szUrl, pOIProtSink, pOIBindInfo, | 698 HRESULT hr = m_internetSink.OnStart(szUrl, pOIProtSink, pOIBindInfo, |
726 grfPI, dwReserved, pTargetProtocol); | 699 grfPI, dwReserved, pTargetProtocol); |
727 | 700 |
728 //We return INET_E_REDIRECT_FAILED in case we have iframe blocking. | 701 //We return INET_E_REDIRECT_FAILED in case we have iframe blocking. |
729 if (hr == INET_E_REDIRECT_FAILED) | 702 if (hr == INET_E_REDIRECT_FAILED) |
730 { | 703 { |
731 return S_OK; | 704 return S_OK; |
732 } | 705 } |
733 CComPtr<IInternetProtocolSink> spSink; | 706 CComPtr<IInternetProtocolSink> spSink; |
734 CComPtr<IInternetBindInfo> spBindInfo; | |
735 if (SUCCEEDED(hr)) | 707 if (SUCCEEDED(hr)) |
736 { | 708 { |
737 hr = m_internetSink.QueryInterface(&spSink); | 709 hr = m_internetSink.QueryInterface(&spSink); |
738 ATLASSERT(SUCCEEDED(hr) && spSink != 0); | 710 ATLASSERT(SUCCEEDED(hr) && spSink != 0); |
739 } | 711 } |
740 if (SUCCEEDED(hr)) | 712 if (SUCCEEDED(hr)) |
741 { | 713 { |
742 hr = m_internetSink.QueryInterface(&spBindInfo); | 714 hr = pTargetProtocol->Start(szUrl, spSink, pOIBindInfo, grfPI, dwReserved)
; |
743 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); | |
744 } | |
745 if (SUCCEEDED(hr)) | |
746 { | |
747 hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, | |
748 dwReserved); | |
749 } | |
750 else | |
751 { | |
752 | |
753 } | 715 } |
754 return hr; | 716 return hr; |
755 } | 717 } |
756 template <class Sink> | 718 template <class Sink> |
757 inline HRESULT CustomSinkStartPolicy<Sink>::Read(/* [in, out] */ void *pv,/* [
in] */ ULONG cb,/* [out] */ ULONG *pcbRead) | 719 inline HRESULT CustomSinkStartPolicy<Sink>::Read(/* [in, out] */ void *pv,/* [
in] */ ULONG cb,/* [out] */ ULONG *pcbRead) |
758 { | 720 { |
759 return m_internetSink.Read(pv, cb, pcbRead); | 721 return m_internetSink.Read(pv, cb, pcbRead); |
760 } | 722 } |
761 | 723 |
762 // ===== CInternetProtocol ===== | 724 // ===== CInternetProtocol ===== |
(...skipping 23 matching lines...) Expand all Loading... |
786 inline STDMETHODIMP CInternetProtocol<StartPolicy, ThreadModel>::Read( | 748 inline STDMETHODIMP CInternetProtocol<StartPolicy, ThreadModel>::Read( |
787 /* [in, out] */ void *pv, | 749 /* [in, out] */ void *pv, |
788 /* [in] */ ULONG cb, | 750 /* [in] */ ULONG cb, |
789 /* [out] */ ULONG *pcbRead) | 751 /* [out] */ ULONG *pcbRead) |
790 { | 752 { |
791 return StartPolicy::Read(pv, cb, pcbRead); | 753 return StartPolicy::Read(pv, cb, pcbRead); |
792 } | 754 } |
793 } // end namespace PassthroughAPP | 755 } // end namespace PassthroughAPP |
794 | 756 |
795 #endif // PASSTHROUGHAPP_PROTOCOLIMPL_INL | 757 #endif // PASSTHROUGHAPP_PROTOCOLIMPL_INL |
OLD | NEW |