Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9021)

Unified Diff: chrome_frame/bho.cc

Issue 274071: When Chrome hands off a URL to be opened by the external host by the ViewHost... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/bho.h ('k') | chrome_frame/chrome_active_document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/bho.cc
===================================================================
--- chrome_frame/bho.cc (revision 29317)
+++ chrome_frame/bho.cc (working copy)
@@ -17,10 +17,14 @@
#include "chrome_frame/protocol_sink_wrap.h"
#include "chrome_frame/utils.h"
#include "chrome_frame/vtable_patch_manager.h"
+#include "net/http/http_util.h"
const wchar_t kPatchProtocols[] = L"PatchProtocols";
static const int kIBrowserServiceOnHttpEquivIndex = 30;
+base::LazyInstance<base::ThreadLocalPointer<Bho> >
+ Bho::bho_current_thread_instance_(base::LINKER_INITIALIZED);
+
PatchHelper g_patch_helper;
BEGIN_VTABLE_PATCHES(IBrowserService)
@@ -63,6 +67,14 @@
<< " Site: " << site << " Error: " << hr;
}
}
+ // Save away our BHO instance in TLS which enables it to be referenced by
+ // our active document/activex instances to query referrer and other
+ // information for a URL.
+ AddRef();
+ bho_current_thread_instance_.Pointer()->Set(this);
+ } else {
+ bho_current_thread_instance_.Pointer()->Set(NULL);
+ Release();
}
return IObjectWithSiteImpl<Bho>::SetSite(site);
@@ -112,6 +124,25 @@
}
}
}
+
+ referrer_.clear();
+
+ // Save away the referrer in case our active document needs it to initiate
+ // navigation in chrome.
+ if (headers && V_VT(headers) == VT_BSTR && headers->bstrVal != NULL) {
+ std::string raw_headers_utf8 = WideToUTF8(headers->bstrVal);
+ std::string http_headers =
+ net::HttpUtil::AssembleRawHeaders(raw_headers_utf8.c_str(),
+ raw_headers_utf8.length());
+ net::HttpUtil::HeadersIterator it(http_headers.begin(), http_headers.end(),
+ "\r\n");
+ while (it.GetNext()) {
+ if (LowerCaseEqualsASCII(it.name(), "referer")) {
+ referrer_ = it.values();
+ break;
+ }
+ }
+ }
return S_OK;
}
@@ -210,6 +241,11 @@
return S_OK;
}
+Bho* Bho::GetCurrentThreadBhoInstance() {
+ DCHECK(bho_current_thread_instance_.Pointer()->Get() != NULL);
+ return bho_current_thread_instance_.Pointer()->Get();
+}
+
void PatchHelper::InitializeAndPatchProtocolsIfNeeded() {
if (state_ != UNKNOWN)
return;
« no previous file with comments | « chrome_frame/bho.h ('k') | chrome_frame/chrome_active_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698