diff options
Diffstat (limited to 'chrome_frame/http_negotiate.cc')
-rw-r--r-- | chrome_frame/http_negotiate.cc | 31 |
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"; |