summaryrefslogtreecommitdiffstats
path: root/chrome_frame/http_negotiate.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 01:10:47 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 01:10:47 +0000
commit6ee88534895ff56a131400acfd2a837824ef1ead (patch)
treedda29859ab5e7ee86fc80afdc1f3dca3ac86438d /chrome_frame/http_negotiate.cc
parent6044824e6c218ea5c801934ac52b88d3b10f89eb (diff)
downloadchromium_src-6ee88534895ff56a131400acfd2a837824ef1ead.zip
chromium_src-6ee88534895ff56a131400acfd2a837824ef1ead.tar.gz
chromium_src-6ee88534895ff56a131400acfd2a837824ef1ead.tar.bz2
With the ChromeFrame IMoniker patch in the referrer would not propagate correctly to Chrome when we switch from IE to CF. In ChromeFrame
the referrer is set in the navigation manager which receives this in the IHttpNegotiate::BeginningTransaction patch. When we switch from IE to cF via the moniker patch we receive two calls to BeginningTransaction, the first one with the referrer and the other one without the referrer for the same URL causing the referrer to be overwritten. Fix is to handle this case. The referrer is cleared in our BeforeNavigate notification. I also moved some functions to chrome frame utils as part of this CL. Fixes bug http://code.google.com/p/chromium/issues/detail?id=41680 Bug=41680 Review URL: http://codereview.chromium.org/1653006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/http_negotiate.cc')
-rw-r--r--chrome_frame/http_negotiate.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/chrome_frame/http_negotiate.cc b/chrome_frame/http_negotiate.cc
index a627ad8..a95255a 100644
--- a/chrome_frame/http_negotiate.cc
+++ b/chrome_frame/http_negotiate.cc
@@ -207,15 +207,28 @@ HRESULT HttpNegotiatePatch::BeginningTransaction(
ScopedComPtr<IWebBrowser2> browser2;
DoQueryService(IID_ITargetFrame2, me, browser2.Receive());
if (browser2) {
- NavigationManager* mgr = NavigationManager::GetThreadInstance();
- if (mgr) {
- VARIANT_BOOL is_top_level = VARIANT_FALSE;
- browser2->get_TopLevelContainer(&is_top_level);
- mgr->OnBeginningTransaction(is_top_level != VARIANT_FALSE, url, headers,
- *additional_headers);
- DLOG(INFO) << "called OnBeginningTransaction " << is_top_level;
- } else {
- DLOG(INFO) << "No NavigationManager";
+ VARIANT_BOOL is_top_level = VARIANT_FALSE;
+ browser2->get_TopLevelContainer(&is_top_level);
+
+ DLOG(INFO) << "called OnBeginningTransaction " << is_top_level;
+
+ if (is_top_level != VARIANT_FALSE) {
+ std::string referrer = FindReferrerFromHeaders(headers,
+ *additional_headers);
+ NavigationManager* mgr = NavigationManager::GetThreadInstance();
+ if (mgr) {
+ // When we switch from IE to CF the BeginningTransaction function is
+ // called twice. The first call contains the referrer while the
+ // second call does not. We set the referrer only if the URL in the
+ // navigation manager changes. The URL in the navigation manager
+ // is reset in BeforeNavigate2
+ if (!referrer.empty()) {
+ DCHECK(mgr->referrer().empty());
+ mgr->set_referrer(referrer);
+ }
+ } else {
+ DLOG(INFO) << "No NavigationManager";
+ }
}
} else {
DLOG(INFO) << "No IWebBrowser2";