diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 21:34:50 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 21:34:50 +0000 |
commit | e4e141d03e82e4918285711b7658e824e33b5107 (patch) | |
tree | d073513b4753f814f004489544801efda87ab3b8 /chrome_frame | |
parent | 56f0ffc81718531755afa224f4b4b44f07d96137 (diff) | |
download | chromium_src-e4e141d03e82e4918285711b7658e824e33b5107.zip chromium_src-e4e141d03e82e4918285711b7658e824e33b5107.tar.gz chromium_src-e4e141d03e82e4918285711b7658e824e33b5107.tar.bz2 |
Handle a case where the document is being served up from cache. In that case we have to get to the browser service object via a different set of QS calls.
TEST=This is a part of the onhttpequiv effort. For now there won't be any visible changes since onhttpequiv is disabled but once it becomes enabled again, CF will be detected for cached pages as well as non-cached.
BUG=none
Review URL: http://codereview.chromium.org/573012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38132 0039d316-1c4b-4281-b951-d872f2087c98
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); } |