summaryrefslogtreecommitdiffstats
path: root/chrome_frame/urlmon_moniker.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/urlmon_moniker.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/urlmon_moniker.cc')
-rw-r--r--chrome_frame/urlmon_moniker.cc52
1 files changed, 1 insertions, 51 deletions
diff --git a/chrome_frame/urlmon_moniker.cc b/chrome_frame/urlmon_moniker.cc
index f73b8af..4713da0 100644
--- a/chrome_frame/urlmon_moniker.cc
+++ b/chrome_frame/urlmon_moniker.cc
@@ -11,6 +11,7 @@
#include "chrome_frame/bind_context_info.h"
#include "chrome_frame/chrome_active_document.h"
#include "chrome_frame/urlmon_bind_status_callback.h"
+#include "chrome_frame/utils.h"
#include "chrome_frame/vtable_patch_manager.h"
#include "net/http/http_util.h"
@@ -25,32 +26,6 @@ BEGIN_VTABLE_PATCHES(IMoniker)
VTABLE_PATCH_ENTRY(kMonikerBindToStorage, MonikerPatch::BindToStorage)
END_VTABLE_PATCHES()
-namespace {
-std::string FindReferrerFromHeaders(const wchar_t* headers,
- const wchar_t* additional_headers) {
- std::string referrer;
-
- const wchar_t* both_headers[] = { headers, additional_headers };
- for (int i = 0; referrer.empty() && i < arraysize(both_headers); ++i) {
- if (!both_headers[i])
- continue;
- std::string raw_headers_utf8 = WideToUTF8(both_headers[i]);
- net::HttpUtil::HeadersIterator it(raw_headers_utf8.begin(),
- raw_headers_utf8.end(), "\r\n");
- while (it.GetNext()) {
- if (LowerCaseEqualsASCII(it.name(), "referer")) {
- referrer = it.values();
- break;
- }
- }
- }
-
- return referrer;
-}
-
-} // end namespace
-
-
////////////////////////////
HRESULT NavigationManager::NavigateToCurrentUrlInCF(IBrowserService* browser) {
@@ -97,31 +72,6 @@ bool NavigationManager::IsTopLevelUrl(const wchar_t* url) {
return CompareUrlsWithoutFragment(url_.c_str(), url);
}
-void NavigationManager::OnBeginningTransaction(bool is_top_level,
- const wchar_t* url, const wchar_t* headers,
- const wchar_t* additional_headers) {
- DCHECK(url != NULL);
-
- // We've seen this happen on the first page load in IE8 (it might also happen
- // in other versions of IE) and for some reason we did not get a call to
- // BeginningTransaction the first time it happened and this time around we're
- // using a cached data object that didn't get the request headers or URL.
- DLOG_IF(ERROR, lstrlenW(url) == 0) << __FUNCTION__ << "Invalid URL.";
-
- if (!is_top_level)
- return;
-
- if (url_.compare(url) != 0) {
- DLOG(INFO) << __FUNCTION__ << " not processing headers for url: " << url
- << " current url is: " << url_;
- return;
- }
-
- // Save away the referrer in case our active document needs it to initiate
- // navigation in chrome.
- referrer_ = FindReferrerFromHeaders(headers, additional_headers);
-}
-
/////////////////////////////////////////
NavigationManager* NavigationManager::GetThreadInstance() {