diff options
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/http_negotiate.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome_frame/http_negotiate.cc b/chrome_frame/http_negotiate.cc index 240d9ff..b8a1b9a 100644 --- a/chrome_frame/http_negotiate.cc +++ b/chrome_frame/http_negotiate.cc @@ -6,6 +6,7 @@ #include <atlbase.h> #include <atlcom.h> +#include <htiframe.h> #include "base/logging.h" #include "base/scoped_ptr.h" @@ -52,6 +53,8 @@ BEGIN_VTABLE_PATCHES(IInternetProtocolSink) HttpNegotiatePatch::ReportProgress) END_VTABLE_PATCHES() +namespace { + class SimpleBindStatusCallback : public CComObjectRootEx<CComSingleThreadModel>, public IBindStatusCallback { public: @@ -92,6 +95,28 @@ class SimpleBindStatusCallback : public CComObjectRootEx<CComSingleThreadModel>, } }; +// Attempts to get to the associated browser service for an active request. +HRESULT GetBrowserServiceFromProtocolSink(IInternetProtocolSink* sink, + IBrowserService** browser_service) { + DCHECK(browser_service); + // When fetching a page for the first time (not cached), we can query the + // sink directly for IID_IShellBrowser to get the browser service. + HRESULT hr = DoQueryService(IID_IShellBrowser, sink, browser_service); + if (FAILED(hr)) { + // When the request is being served up from the cache, we have to take + // a different route via IID_ITargetFrame2. + ScopedComPtr<IWebBrowser2> browser2; + hr = DoQueryService(IID_ITargetFrame2, sink, browser2.Receive()); + if (browser2) { + hr = DoQueryService(IID_IShellBrowser, browser2, browser_service); + } + } + + return hr; +} + +} // end namespace + HttpNegotiatePatch::HttpNegotiatePatch() { } @@ -286,7 +311,7 @@ HRESULT HttpNegotiatePatch::ReportProgress( if (is_top_level_request) { ScopedComPtr<IBrowserService> browser; - DoQueryService(IID_IShellBrowser, me, browser.Receive()); + GetBrowserServiceFromProtocolSink(me, browser.Receive()); if (browser) { render_in_chrome_frame = CheckForCFNavigation(browser, true); } |