summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:37:44 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:37:44 +0000
commitc442e9fe2a67bbc9dc4c0d09709649fec2fa0546 (patch)
tree947b2f382b2447e73ccfa669889c318ae9c890e3 /chrome_frame
parent0fab7cdd43e7dd01e69ef5f9c13f5eae6bd54853 (diff)
downloadchromium_src-c442e9fe2a67bbc9dc4c0d09709649fec2fa0546.zip
chromium_src-c442e9fe2a67bbc9dc4c0d09709649fec2fa0546.tar.gz
chromium_src-c442e9fe2a67bbc9dc4c0d09709649fec2fa0546.tar.bz2
Fresh ChromeFrame installs triggered via wave required IE to be restarted for wave to switch to Chrome in the current page/tab.
The ChromeFrame install flow instantiates the ChromeFrame ActiveX which ensures that the IMoniker patches are in place for switching to work. However ChromeFrame relies on the BHO to be loaded in order to determine that a URL is a top level URL. The ChromeFrame ActiveX now attempts to load the BHO dynamically and registers it with the top level IWebBrowser for the page. This fixes bug http://code.google.com/p/chromium/issues/detail?id=42790 Bug=42790 Review URL: http://codereview.chromium.org/1789007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_frame_activex.cc50
-rw-r--r--chrome_frame/chrome_frame_activex.h5
-rw-r--r--chrome_frame/urlmon_moniker.cc14
3 files changed, 68 insertions, 1 deletions
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index a46d294..dfa7a85 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -454,6 +454,11 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
IsIEInPrivate(), true)) {
return E_FAIL;
}
+
+ // We need to bootstrap our BHO if IE is running while chrome frame is
+ // installed. For new tabs and windows the newly registered BHO's are
+ // loaded. The bootstrapping is only needed for the current tab.
+ RegisterBHOIfNeeded(client_site);
}
return hr;
@@ -600,3 +605,48 @@ HRESULT ChromeFrameActivex::InstallTopLevelHook(IOleClientSite* client_site) {
return chrome_wndproc_hook_ ? S_OK : E_FAIL;
}
+
+HRESULT ChromeFrameActivex::RegisterBHOIfNeeded(
+ IOleClientSite* client_site) {
+ if (!client_site) {
+ NOTREACHED() << "Invalid client site";
+ return E_FAIL;
+ }
+
+ if (NavigationManager::GetThreadInstance() != NULL) {
+ DLOG(INFO) << "BHO already loaded";
+ return S_OK;
+ }
+
+ ScopedComPtr<IWebBrowser2> web_browser2;
+ HRESULT hr = DoQueryService(SID_SWebBrowserApp, client_site,
+ web_browser2.Receive());
+ if (FAILED(hr) || web_browser2.get() == NULL) {
+ DLOG(WARNING) << "Failed to get IWebBrowser2 from client site. Error:"
+ << StringPrintf(" 0x%08X", hr);
+ return hr;
+ }
+
+ wchar_t bho_class_id_as_string[MAX_PATH] = {0};
+ StringFromGUID2(CLSID_ChromeFrameBHO, bho_class_id_as_string,
+ arraysize(bho_class_id_as_string));
+
+ ScopedComPtr<IObjectWithSite> bho;
+ hr = bho.CreateInstance(CLSID_ChromeFrameBHO, NULL, CLSCTX_INPROC_SERVER);
+ if (FAILED(hr)) {
+ NOTREACHED() << "Failed to register ChromeFrame BHO. Error:"
+ << StringPrintf(" 0x%08X", hr);
+ return hr;
+ }
+
+ hr = bho->SetSite(web_browser2);
+ if (FAILED(hr)) {
+ NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:"
+ << StringPrintf(" 0x%08X", hr);
+ return hr;
+ }
+
+ web_browser2->PutProperty(ScopedBstr(bho_class_id_as_string),
+ ScopedVariant(bho));
+ return S_OK;
+}
diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h
index dec399e..35f866c 100644
--- a/chrome_frame/chrome_frame_activex.h
+++ b/chrome_frame/chrome_frame_activex.h
@@ -136,6 +136,11 @@ END_MSG_MAP()
// Installs a hook on the top-level window hosting the control.
HRESULT InstallTopLevelHook(IOleClientSite* client_site);
+ // On a fresh install of ChromeFrame the BHO will not be loaded in existing
+ // IE tabs/windows. This function instantiates the BHO and registers it
+ // explicitly.
+ HRESULT RegisterBHOIfNeeded(IOleClientSite* client_site);
+
// A hook attached to the top-level window containing the ActiveX control.
HHOOK chrome_wndproc_hook_;
};
diff --git a/chrome_frame/urlmon_moniker.cc b/chrome_frame/urlmon_moniker.cc
index fe064ce..4150927 100644
--- a/chrome_frame/urlmon_moniker.cc
+++ b/chrome_frame/urlmon_moniker.cc
@@ -146,12 +146,24 @@ bool ShouldWrapCallback(IMoniker* moniker, REFIID iid, IBindCtx* bind_context) {
return false;
}
+ // TODO(ananta)
+ // Use the IsSubFrameRequest function to determine if a request is a top
+ // level request. Something like this.
+ // ScopedComPtr<IUnknown> bscb_holder;
+ // bind_context->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive());
+ // if (bscb_holder) {
+ // ScopedComPtr<IHttpNegotiate> http_negotiate;
+ // http_negotiate.QueryFrom(bscb_holder);
+ // if (http_negotiate && !IsSubFrameRequest(http_negotiate))
+ // return true;
+ // }
+ // There are some cases where the IsSubFrameRequest function can return
+ // incorrect results.
bool should_wrap = mgr->IsTopLevelUrl(url);
if (!should_wrap) {
DLOG(INFO) << __FUNCTION__ << " Url: " << url <<
" Not wrapping: Not top level url.";
}
-
return should_wrap;
}