| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 #pragma once | 1 #pragma once |
| 2 | 2 #include <cstdint> |
| 3 #include "ProtocolCF.h" | 3 #include "ProtocolCF.h" |
| 4 #include "ProtocolImpl.h" | 4 #include "ProtocolImpl.h" |
| 5 #define IE_MAX_URL_LENGTH 2048 | 5 #define IE_MAX_URL_LENGTH 2048 |
| 6 | 6 |
| 7 class WBPassthruSink : | 7 class WBPassthruSink : |
| 8 public PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CComM ultiThreadModel>, | 8 public PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CComM ultiThreadModel>, |
| 9 public IHttpNegotiate | 9 public IHttpNegotiate |
| 10 { | 10 { |
| 11 typedef PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CCom MultiThreadModel> BaseClass; | 11 typedef PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CCom MultiThreadModel> BaseClass; |
| 12 | 12 |
| 13 public: | 13 public: |
| 14 WBPassthruSink(); | |
| 14 | 15 |
| 15 » bool m_shouldBlock; | 16 » uint64_t m_currentPositionOfSentPage; |
| 16 » bool m_lastDataReported; | |
| 17 CComPtr<IInternetProtocol> m_pTargetProtocol; | 17 CComPtr<IInternetProtocol> m_pTargetProtocol; |
| 18 int m_contentType; | |
| 19 std::wstring m_boundDomain; | |
| 20 bool m_isCustomResponse; | |
| 18 | 21 |
| 19 int GetContentTypeFromMimeType(CString mimeType); | 22 » int GetContentTypeFromMimeType(const CString& mimeType); |
| 20 int GetContentTypeFromURL(std::wstring& src); | 23 int GetContentTypeFromURL(const std::wstring& src); |
|
sergei
2014/10/21 09:45:17
Why is it not const here and below?
Eric
2014/10/21 17:19:52
Because I'm focusing only on type conversion. I ha
|
sergei
2015/01/06 13:18:18
We use tabs in this file, but here are spaces, it'
Eric
2015/01/06 19:38:59
Even more than inconsistent, the existing code vio
|
| 21 int GetContentType(CString mimeType, std::wstring& domain, std::wstring& src); | 24 int GetContentType(const CString& mimeType, const std::wstring& domain, const std::wstring& src); |
| 25 » bool IsFlashRequest(const wchar_t* const* additionalHeaders); | |
| 22 public: | 26 public: |
| 23 BEGIN_COM_MAP(WBPassthruSink) | 27 BEGIN_COM_MAP(WBPassthruSink) |
| 24 COM_INTERFACE_ENTRY(IHttpNegotiate) | 28 COM_INTERFACE_ENTRY(IHttpNegotiate) |
| 25 COM_INTERFACE_ENTRY_CHAIN(BaseClass) | 29 COM_INTERFACE_ENTRY_CHAIN(BaseClass) |
| 26 END_COM_MAP() | 30 END_COM_MAP() |
| 27 | 31 |
| 28 BEGIN_SERVICE_MAP(WBPassthruSink) | 32 BEGIN_SERVICE_MAP(WBPassthruSink) |
| 29 SERVICE_ENTRY(IID_IHttpNegotiate) | 33 SERVICE_ENTRY(IID_IHttpNegotiate) |
| 30 END_SERVICE_MAP() | 34 END_SERVICE_MAP() |
| 31 | 35 |
| 32 STDMETHODIMP BeginningTransaction( | 36 STDMETHODIMP BeginningTransaction( |
| 33 /* [in] */ LPCWSTR szURL, | 37 /* [in] */ LPCWSTR szURL, |
| 34 /* [in] */ LPCWSTR szHeaders, | 38 /* [in] */ LPCWSTR szHeaders, |
| 35 /* [in] */ DWORD dwReserved, | 39 /* [in] */ DWORD dwReserved, |
| 36 /* [out] */ LPWSTR *pszAdditionalHeaders); | 40 /* [out] */ LPWSTR *pszAdditionalHeaders); |
| 37 | 41 |
| 38 STDMETHODIMP OnResponse( | 42 STDMETHODIMP OnResponse( |
| 39 /* [in] */ DWORD dwResponseCode, | 43 /* [in] */ DWORD dwResponseCode, |
| 40 /* [in] */ LPCWSTR szResponseHeaders, | 44 /* [in] */ LPCWSTR szResponseHeaders, |
| 41 /* [in] */ LPCWSTR szRequestHeaders, | 45 /* [in] */ LPCWSTR szRequestHeaders, |
| 42 /* [out] */ LPWSTR *pszAdditionalRequestHeaders); | 46 /* [out] */ LPWSTR *pszAdditionalRequestHeaders); |
| 43 | 47 |
| 44 HRESULT OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, | 48 HRESULT OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, |
| 45 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserv ed, | 49 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserv ed, |
| 46 » » IInternetProtocol* pTargetProtocol); | 50 » » IInternetProtocol* pTargetProtocol, bool& handled); |
| 47 » HRESULT Read(void *pv, ULONG cb, ULONG* pcbRead); | 51 » HRESULT OnRead(void *pv, ULONG cb, ULONG* pcbRead); |
| 48 | 52 |
| 49 STDMETHODIMP ReportProgress( | 53 STDMETHODIMP ReportProgress( |
| 50 /* [in] */ ULONG ulStatusCode, | 54 /* [in] */ ULONG ulStatusCode, |
| 51 /* [in] */ LPCWSTR szStatusText); | 55 /* [in] */ LPCWSTR szStatusText); |
| 56 | |
| 57 STDMETHODIMP ReportResult( | |
| 58 /* [in] */ HRESULT hrResult, | |
| 59 /* [in] */ DWORD dwError, | |
| 60 /* [in] */ LPCWSTR szResult); | |
| 52 | 61 |
| 53 STDMETHODIMP Switch( | 62 STDMETHODIMP Switch( |
| 54 /* [in] */ PROTOCOLDATA *pProtocolData); | 63 /* [in] */ PROTOCOLDATA *pProtocolData); |
| 55 }; | 64 }; |
| 56 | 65 |
| 57 class WBPassthru; | 66 class WBPassthru; |
| 58 typedef PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink> WBStar tPolicy; | 67 typedef PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink> WBStar tPolicy; |
| 59 | 68 |
| 60 class WBPassthru : public PassthroughAPP::CInternetProtocol<WBStartPolicy> | 69 class WBPassthru : public PassthroughAPP::CInternetProtocol<WBStartPolicy> |
| 61 { | 70 { |
| 71 typedef PassthroughAPP::CInternetProtocol<WBStartPolicy> BaseClass; | |
| 62 public: | 72 public: |
| 73 WBPassthru(); | |
| 63 // IInternetProtocolRoot | 74 // IInternetProtocolRoot |
| 64 STDMETHODIMP Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, | 75 STDMETHODIMP Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, |
| 65 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved); | 76 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) override ; |
| 66 | 77 |
| 67 //IInternetProtocol | 78 //IInternetProtocol |
| 68 STDMETHODIMP Read(» /* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */ ULONG *pcbRead); | 79 STDMETHODIMP Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */ ULO NG *pcbRead) override; |
| 80 | |
| 81 bool m_shouldSupplyCustomContent; | |
| 69 }; | 82 }; |
| LEFT | RIGHT |