summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-01 00:06:00 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-01 00:06:00 +0000
commite12a3b8ba0106b816db9f45a74ddd42f344a267d (patch)
treec5ed65d2eec1f311f8b868ef054489af79a5ef7f
parent975126cdf52a2f56522cb549e5dae9a7281ef851 (diff)
downloadchromium_src-e12a3b8ba0106b816db9f45a74ddd42f344a267d.zip
chromium_src-e12a3b8ba0106b816db9f45a74ddd42f344a267d.tar.gz
chromium_src-e12a3b8ba0106b816db9f45a74ddd42f344a267d.tar.bz2
The chrome frame install script instantiates the chrome frame activex via the new ActiveXObject call, which causes it
to not receive the IOleObject_SetClientSite call. We now bootstrap our BHO in an explicit method call RegisterBHOIfNeeded Fixes bug http://code.google.com/p/chromium/issues/detail?id=42790 Bug=42790 Review URL: http://codereview.chromium.org/1823001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46165 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/CFInstall.js1
-rw-r--r--chrome_frame/chrome_frame_activex.cc20
-rw-r--r--chrome_frame/chrome_frame_activex.h18
-rw-r--r--chrome_frame/chrome_frame_activex_base.h4
-rw-r--r--chrome_frame/chrome_tab.idl4
5 files changed, 33 insertions, 14 deletions
diff --git a/chrome_frame/CFInstall.js b/chrome_frame/CFInstall.js
index e8190cb6..5f2efdf 100644
--- a/chrome_frame/CFInstall.js
+++ b/chrome_frame/CFInstall.js
@@ -49,6 +49,7 @@
try {
var obj = new ActiveXObject('ChromeTab.ChromeFrame');
if (obj) {
+ obj.RegisterBHOIfNeeded();
return true;
}
} catch(e) {
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index dfa7a85..ad582bc 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -377,6 +377,14 @@ STDMETHODIMP ChromeFrameActivex::put_src(BSTR src) {
return Base::put_src(src);
}
+STDMETHODIMP ChromeFrameActivex::SetSite(IUnknown* site) {
+ // 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.
+ site_ = site;
+ return IObjectWithSiteImpl<ChromeFrameActivex>::SetSite(site);
+}
+
HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
IOleClientSite* client_site) {
HRESULT hr = Base::IOleObject_SetClientSite(client_site);
@@ -454,11 +462,6 @@ 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;
@@ -606,9 +609,8 @@ HRESULT ChromeFrameActivex::InstallTopLevelHook(IOleClientSite* client_site) {
return chrome_wndproc_hook_ ? S_OK : E_FAIL;
}
-HRESULT ChromeFrameActivex::RegisterBHOIfNeeded(
- IOleClientSite* client_site) {
- if (!client_site) {
+HRESULT ChromeFrameActivex::RegisterBHOIfNeeded() {
+ if (!site_) {
NOTREACHED() << "Invalid client site";
return E_FAIL;
}
@@ -619,7 +621,7 @@ HRESULT ChromeFrameActivex::RegisterBHOIfNeeded(
}
ScopedComPtr<IWebBrowser2> web_browser2;
- HRESULT hr = DoQueryService(SID_SWebBrowserApp, client_site,
+ HRESULT hr = DoQueryService(SID_SWebBrowserApp, site_,
web_browser2.Receive());
if (FAILED(hr) || web_browser2.get() == NULL) {
DLOG(WARNING) << "Failed to get IWebBrowser2 from client site. Error:"
diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h
index 35f866c..7192126 100644
--- a/chrome_frame/chrome_frame_activex.h
+++ b/chrome_frame/chrome_frame_activex.h
@@ -34,6 +34,7 @@ class ATL_NO_VTABLE ChromeFrameActivex
public IObjectSafetyImpl<ChromeFrameActivex,
INTERFACESAFE_FOR_UNTRUSTED_CALLER |
INTERFACESAFE_FOR_UNTRUSTED_DATA>,
+ public IObjectWithSiteImpl<ChromeFrameActivex>,
public IPersistPropertyBag {
public:
typedef ChromeFrameActivexBase<ChromeFrameActivex, CLSID_ChromeFrame> Base;
@@ -43,6 +44,7 @@ class ATL_NO_VTABLE ChromeFrameActivex
DECLARE_REGISTRY_RESOURCEID(IDR_CHROMEFRAME)
BEGIN_COM_MAP(ChromeFrameActivex)
+ COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IObjectSafety)
COM_INTERFACE_ENTRY(IPersistPropertyBag)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
@@ -83,6 +85,15 @@ END_MSG_MAP()
// Overridden to perform security checks.
STDMETHOD(put_src)(BSTR src);
+ // IObjectWithSite
+ STDMETHOD(SetSite)(IUnknown* site);
+
+ // IChromeFrame
+ // 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.
+ STDMETHOD(RegisterBHOIfNeeded)();
+
protected:
// ChromeFrameDelegate overrides
virtual void OnLoad(int tab_handle, const GURL& url);
@@ -136,13 +147,10 @@ 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_;
+
+ ScopedComPtr<IUnknown> site_;
};
#endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_H_
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index fee5ba2..eb1391f 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -808,6 +808,10 @@ END_MSG_MAP()
return S_OK;
}
+ STDMETHOD(RegisterBHOIfNeeded)() {
+ return E_NOTIMPL;
+ }
+
// Returns the vector of event handlers for a given event (e.g. "load").
// If the event type isn't recognized, the function fills in a descriptive
// error (IErrorInfo) and returns E_INVALIDARG.
diff --git a/chrome_frame/chrome_tab.idl b/chrome_frame/chrome_tab.idl
index 3ce87d0..aa492bc 100644
--- a/chrome_frame/chrome_tab.idl
+++ b/chrome_frame/chrome_tab.idl
@@ -77,6 +77,10 @@ interface IChromeFrame : IDispatch {
[id(14), hidden]
// This method is available only when the control is in privileged mode.
HRESULT getEnabledExtensions();
+
+ [id(15)]
+ // This method bootstraps the BHO if it is not already loaded.
+ HRESULT RegisterBHOIfNeeded();
};
[