From c5209507806cc654cb683b32f5fea25951c57782 Mon Sep 17 00:00:00 2001 From: "mark.finkle@gmail.com" Date: Wed, 16 May 2007 19:19:50 -0700 Subject: [PATCH] bug 367519. r=bsmedberg. add XUL and SVG mime type support to the mozilla activex control. Also updated some deprecated ATL macros. --- .../activex/src/control/MozillaBrowser.cpp | 8 +++- .../activex/src/control/MozillaBrowser.h | 39 ++++++++++++------- .../activex/src/control/MozillaBrowser.rgs | 32 +++++++++++++++ 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/embedding/browser/activex/src/control/MozillaBrowser.cpp b/embedding/browser/activex/src/control/MozillaBrowser.cpp index 6cef0e22c73..d8aa5790f11 100644 --- a/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -454,6 +454,13 @@ LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& } } } + else + { + if (mInitialSrc.Length() > 0) + { + Navigate(mInitialSrc, NULL, NULL, NULL, NULL); + } + } } // Clip the child windows out of paint operations @@ -1911,7 +1918,6 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_RegisterAsDropTarget(VARIANT_BOOL return S_OK; } - /////////////////////////////////////////////////////////////////////////////// // Ole Command Handlers diff --git a/embedding/browser/activex/src/control/MozillaBrowser.h b/embedding/browser/activex/src/control/MozillaBrowser.h index c59f6656d97..ee07416c7d4 100644 --- a/embedding/browser/activex/src/control/MozillaBrowser.h +++ b/embedding/browser/activex/src/control/MozillaBrowser.h @@ -82,6 +82,7 @@ class ATL_NO_VTABLE CMozillaBrowser : public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>, public IPersistStreamInitImpl, public IPersistStorageImpl, + public IPersistPropertyBagImpl, public IQuickActivateImpl, public IOleControlImpl, public IOleObjectImpl, @@ -93,6 +94,7 @@ class ATL_NO_VTABLE CMozillaBrowser : public IOleCommandTargetImpl, public IConnectionPointContainerImpl, public ISpecifyPropertyPagesImpl, + public IObjectSafetyImpl, public IMozControlBridge { friend CWebBrowserContainer; @@ -118,24 +120,27 @@ BEGIN_COM_MAP(CMozillaBrowser) COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, CProxyDWebBrowserEvents2) // Other ActiveX/OLE interfaces - COM_INTERFACE_ENTRY_IMPL(IViewObjectEx) - COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx) - COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx) - COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject) - COM_INTERFACE_ENTRY_IMPL(IOleControl) - COM_INTERFACE_ENTRY_IMPL(IOleObject) - COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // This causes size assertion in ATL - COM_INTERFACE_ENTRY_IMPL(IPersistStorage) - COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit) - COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages) - COM_INTERFACE_ENTRY_IMPL(IDataObject) + COM_INTERFACE_ENTRY(IViewObjectEx) + COM_INTERFACE_ENTRY_IID(IID_IViewObject2, IViewObjectEx) + COM_INTERFACE_ENTRY_IID(IID_IViewObject, IViewObjectEx) + COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) + COM_INTERFACE_ENTRY(IOleControl) + COM_INTERFACE_ENTRY(IOleObject) + COM_INTERFACE_ENTRY(IQuickActivate) // This causes size assertion in ATL + COM_INTERFACE_ENTRY2(IPersist, IPersistPropertyBag) + COM_INTERFACE_ENTRY(IPersistPropertyBag) + COM_INTERFACE_ENTRY(IPersistStreamInit) + COM_INTERFACE_ENTRY(IPersistStorage) + COM_INTERFACE_ENTRY(ISpecifyPropertyPages) + COM_INTERFACE_ENTRY(IDataObject) COM_INTERFACE_ENTRY(IOleCommandTarget) COM_INTERFACE_ENTRY(IProvideClassInfo) COM_INTERFACE_ENTRY(IProvideClassInfo2) COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) + COM_INTERFACE_ENTRY(IConnectionPointContainer) + COM_INTERFACE_ENTRY(IObjectSafety) END_COM_MAP() // Properties supported by the control that map onto property @@ -145,6 +150,7 @@ BEGIN_PROPERTY_MAP(CMozillaBrowser) // Example entries // PROP_ENTRY("Property Description", dispid, clsid) PROP_PAGE(CLSID_StockColorPage) + PROP_DATA_ENTRY("SRC", mInitialSrc, VT_BSTR) END_PROPERTY_MAP() // Table of outgoing connection points. Anyone subscribing @@ -386,6 +392,8 @@ protected: BOOL mHaveDropTargetFlag; // Contains an error message if startup went wrong tstring mStartupErrorMessage; + // Initial source url passed in via the container + CComBSTR mInitialSrc; // List of registered browser helper objects CComUnkPtr *mBrowserHelperList; ULONG mBrowserHelperListCount; @@ -425,7 +433,8 @@ public: virtual nsresult GetDOMWindow(nsIDOMWindow **aDOMWindow); virtual nsresult GetPrefs(nsIPrefBranch **aPrefBranch); virtual PRBool BrowserIsValid(); - // IWebBrowser + +// IWebBrowser virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp); virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister); diff --git a/embedding/browser/activex/src/control/MozillaBrowser.rgs b/embedding/browser/activex/src/control/MozillaBrowser.rgs index 4bf4b5113df..deec131285f 100644 --- a/embedding/browser/activex/src/control/MozillaBrowser.rgs +++ b/embedding/browser/activex/src/control/MozillaBrowser.rgs @@ -29,6 +29,38 @@ HKCR } 'TypeLib' = s '{1339B53E-3453-11D2-93B9-000000000000}' 'Version' = s '1.0' + ForceRemove 'EnableFullPage' + { + ForceRemove .xul + ForceRemove .svg + } } } + NoRemove MIME + { + NoRemove Database + { + NoRemove 'Content Type' + { + ForceRemove 'application/vnd.mozilla.xul+xml' + { + val Extension = s '.xul' + val CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' + } + ForceRemove 'image/svg+xml' + { + val Extension = s '.svg' + val CLSID = s '{1339B54C-3453-11D2-93B9-000000000000}' + } + } + } + } + ForceRemove .xul = s 'Mozilla.Browser' + { + ForceRemove val 'Content Type' = s 'application/vnd.mozilla.xul+xml' + } + ForceRemove .svg = s 'Mozilla.Browser' + { + ForceRemove val 'Content Type' = s 'image/svg+xml' + } }