| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome_frame/http_negotiate.h" | 5 #include "chrome_frame/http_negotiate.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 HttpNegotiatePatch::StartBinding) | 45 HttpNegotiatePatch::StartBinding) |
| 46 END_VTABLE_PATCHES() | 46 END_VTABLE_PATCHES() |
| 47 | 47 |
| 48 static const int kInternetProtocolSinkReportProgressIndex = 4; | 48 static const int kInternetProtocolSinkReportProgressIndex = 4; |
| 49 | 49 |
| 50 BEGIN_VTABLE_PATCHES(IInternetProtocolSink) | 50 BEGIN_VTABLE_PATCHES(IInternetProtocolSink) |
| 51 VTABLE_PATCH_ENTRY(kInternetProtocolSinkReportProgressIndex, | 51 VTABLE_PATCH_ENTRY(kInternetProtocolSinkReportProgressIndex, |
| 52 HttpNegotiatePatch::ReportProgress) | 52 HttpNegotiatePatch::ReportProgress) |
| 53 END_VTABLE_PATCHES() | 53 END_VTABLE_PATCHES() |
| 54 | 54 |
| 55 class SimpleBindStatusCallback : public CComObjectRootEx<CComSingleThreadModel>, |
| 56 public IBindStatusCallback { |
| 57 public: |
| 58 BEGIN_COM_MAP(SimpleBindStatusCallback) |
| 59 COM_INTERFACE_ENTRY(IBindStatusCallback) |
| 60 END_COM_MAP() |
| 61 |
| 62 // IBindStatusCallback implementation |
| 63 STDMETHOD(OnStartBinding)(DWORD reserved, IBinding* binding) { |
| 64 return E_NOTIMPL; |
| 65 } |
| 66 |
| 67 STDMETHOD(GetPriority)(LONG* priority) { |
| 68 return E_NOTIMPL; |
| 69 } |
| 70 STDMETHOD(OnLowResource)(DWORD reserved) { |
| 71 return E_NOTIMPL; |
| 72 } |
| 73 |
| 74 STDMETHOD(OnProgress)(ULONG progress, ULONG max_progress, |
| 75 ULONG status_code, LPCWSTR status_text) { |
| 76 return E_NOTIMPL; |
| 77 } |
| 78 STDMETHOD(OnStopBinding)(HRESULT result, LPCWSTR error) { |
| 79 return E_NOTIMPL; |
| 80 } |
| 81 |
| 82 STDMETHOD(GetBindInfo)(DWORD* bind_flags, BINDINFO* bind_info) { |
| 83 return E_NOTIMPL; |
| 84 } |
| 85 |
| 86 STDMETHOD(OnDataAvailable)(DWORD flags, DWORD size, FORMATETC* formatetc, |
| 87 STGMEDIUM* storage) { |
| 88 return E_NOTIMPL; |
| 89 } |
| 90 STDMETHOD(OnObjectAvailable)(REFIID iid, IUnknown* object) { |
| 91 return E_NOTIMPL; |
| 92 } |
| 93 }; |
| 55 | 94 |
| 56 HttpNegotiatePatch::HttpNegotiatePatch() { | 95 HttpNegotiatePatch::HttpNegotiatePatch() { |
| 57 } | 96 } |
| 58 | 97 |
| 59 HttpNegotiatePatch::~HttpNegotiatePatch() { | 98 HttpNegotiatePatch::~HttpNegotiatePatch() { |
| 60 } | 99 } |
| 61 | 100 |
| 62 // static | 101 // static |
| 63 bool HttpNegotiatePatch::Initialize() { | 102 bool HttpNegotiatePatch::Initialize() { |
| 64 if (IS_PATCHED(IHttpNegotiate)) { | 103 if (IS_PATCHED(IHttpNegotiate)) { |
| 65 DLOG(WARNING) << __FUNCTION__ << " called more than once."; | 104 DLOG(WARNING) << __FUNCTION__ << " called more than once."; |
| 66 return true; | 105 return true; |
| 67 } | 106 } |
| 68 | 107 // Use our SimpleBindStatusCallback class as we need a temporary object that |
| 69 // Use our UrlmonUrlRequest class as we need a temporary object that | |
| 70 // implements IBindStatusCallback. | 108 // implements IBindStatusCallback. |
| 71 CComObjectStackEx<UrlmonUrlRequest> request; | 109 CComObjectStackEx<SimpleBindStatusCallback> request; |
| 72 ScopedComPtr<IBindCtx> bind_ctx; | 110 ScopedComPtr<IBindCtx> bind_ctx; |
| 73 HRESULT hr = CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive()); | 111 HRESULT hr = CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive()); |
| 74 DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx"; | 112 DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx"; |
| 75 if (bind_ctx) { | 113 if (bind_ctx) { |
| 76 ScopedComPtr<IUnknown> bscb_holder; | 114 ScopedComPtr<IUnknown> bscb_holder; |
| 77 bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive()); | 115 bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive()); |
| 78 if (bscb_holder) { | 116 if (bscb_holder) { |
| 79 hr = PatchHttpNegotiate(bscb_holder); | 117 hr = PatchHttpNegotiate(bscb_holder); |
| 80 } else { | 118 } else { |
| 81 NOTREACHED() << "Failed to get _BSCB_Holder_"; | 119 NOTREACHED() << "Failed to get _BSCB_Holder_"; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 326 } |
| 289 } | 327 } |
| 290 | 328 |
| 291 if (render_in_chrome_frame) { | 329 if (render_in_chrome_frame) { |
| 292 status_text = kChromeMimeType; | 330 status_text = kChromeMimeType; |
| 293 } | 331 } |
| 294 } | 332 } |
| 295 | 333 |
| 296 return original(me, status_code, status_text); | 334 return original(me, status_code, status_text); |
| 297 } | 335 } |
| OLD | NEW |