Enabling Gecko in MSHTML

Jacek Caban jack at itma.pwr.wroc.pl
Sun Apr 17 15:54:04 CDT 2005


Hi.

Now MSHTML is ready for a patch that enables HTML rendering over
Gecko API. I attached the patch that makes IE works with Wine's MSHTML.
Any comments/suggestions are welcome. If you want to see how
it works, you need to have a working installation of IE and Mozilla
installed
under Wine. Then just set mshtml.dll to be loaded as built in. Excluding
many not implemented parts of API, it needs a better algorithm searching
for Mozilla installation (eg. currently it can't work with only Mozilla
ActiveX
Control installed) and better messaging user that it needs Mozilla, but
I'll fix it in next patches.

I'm not sure if I should presently send it to wine-patches. I still hope
we can make it
work with Linux versions of Mozilla. It would be much better as applications
could 'just run' for users that have Linux Mozilla installed (and most
have),
without any additional installation/downloading . I tried to do it, but
without success as yet. Problem is that we need to pass a native
window handle to
nsIBaseWindow::InitWindow (you may see this call in view.c). In case of
windows version it's no problem as it
means passing HWND, but in case of Linux it is Gtk/GdkWindow
(well, not always as Mozilla can be built to use xlib or qt, but
currently in most cases it's not and we can take care of it later).
To not use gtk/gdk directly in Wine we could patch Mozilla to detect
XID passed and use gdk_window_foreign_new to create GdkWindow.
It should work, I believe, but I was not able to do so. It would be
wonderful if
anyone could give me any insight on it, eg. I'm not sure if I have a
good understanding of how to get the XID for Wine's window. Also I'd
like to know if using gdk inside Wine's windows needs any
tricks/is possible. If you think I should give up and stay with the Windows
version, I'll send this patch to wine-patches.

Thanks,
    Jacek
-------------- next part --------------
? dlls/mshtml/diff
? dlls/mshtml/nsapi.c
? dlls/mshtml/nsembd.c
? dlls/mshtml/nsiface.idl
? dlls/mshtml/tests
Index: dlls/mshtml/.cvsignore
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/.cvsignore,v
retrieving revision 1.2
diff -u -p -r1.2 .cvsignore
--- dlls/mshtml/.cvsignore	24 Mar 2004 03:36:47 -0000	1.2
+++ dlls/mshtml/.cvsignore	17 Apr 2005 20:50:52 -0000
@@ -1,3 +1,4 @@
 Makefile
 mshtml.dll.dbg.c
 mshtml.spec.def
+nsiface.h
Index: dlls/mshtml/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/Makefile.in,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.in
--- dlls/mshtml/Makefile.in	14 Apr 2005 11:30:50 -0000	1.10
+++ dlls/mshtml/Makefile.in	17 Apr 2005 20:50:52 -0000
@@ -10,9 +10,12 @@ EXTRADEFS = -DCOM_NO_WINDOWS_H
 C_SRCS = \
 	htmldoc.c \
 	main.c \
+	nsembd.c \
 	oleobj.c \
 	persist.c \
 	view.c
+
+IDL_SRCS = nsiface.idl
 
 @MAKE_DLL_RULES@
 
Index: dlls/mshtml/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/htmldoc.c,v
retrieving revision 1.6
diff -u -p -r1.6 htmldoc.c
--- dlls/mshtml/htmldoc.c	15 Apr 2005 16:12:45 -0000	1.6
+++ dlls/mshtml/htmldoc.c	17 Apr 2005 20:50:52 -0000
@@ -106,6 +106,7 @@ static ULONG WINAPI HTMLDocument_Release
     TRACE("(%p) ref = %lu\n", This, ref);
 
     if(!ref) {
+        NSContainer_Destroy(This->nscontainer);
         if(This->client)
             IOleClientSite_Release(This->client);
         if(This->ipsite)
@@ -949,6 +950,8 @@ HRESULT HTMLDocument_Create(IUnknown *pU
     hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject);
     if(FAILED(hres))
         HeapFree(GetProcessHeap(), 0, ret);
+
+    ret->nscontainer = NSContainer_Create(ret);
 
     HTMLDocument_Persist_Init(ret);
     HTMLDocument_OleObj_Init(ret);
Index: dlls/mshtml/main.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/main.c,v
retrieving revision 1.9
diff -u -p -r1.9 main.c
--- dlls/mshtml/main.c	14 Apr 2005 11:30:50 -0000	1.9
+++ dlls/mshtml/main.c	17 Apr 2005 20:50:52 -0000
@@ -30,8 +30,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
-#include "winnls.h"
-#include "winreg.h"
 #include "ole2.h"
 #include "docobj.h"
 
@@ -43,78 +41,16 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
-#include "initguid.h"
-
-DEFINE_GUID( CLSID_MozillaBrowser, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00);
-
-typedef HRESULT (WINAPI *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
-typedef BOOL (WINAPI *fnCanUnloadNow)();
-
-static HMODULE hMozCtl;
-
 HINSTANCE hInst;
 
-/* convert a guid to a wide character string */
-static void MSHTML_guid2wstr( const GUID *guid, LPWSTR wstr )
-{
-    char str[40];
-
-    sprintf(str, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-           guid->Data1, guid->Data2, guid->Data3,
-           guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-           guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
-    MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, 40 );
-}
-
-static BOOL MSHTML_GetMozctlPath( LPWSTR szPath, DWORD sz )
-{
-    DWORD r, type;
-    BOOL ret = FALSE;
-    HKEY hkey;
-    static const WCHAR szPre[] = {
-        'S','o','f','t','w','a','r','e','\\',
-        'C','l','a','s','s','e','s','\\',
-        'C','L','S','I','D','\\',0 };
-    static const WCHAR szPost[] = {
-        '\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0 };
-    WCHAR szRegPath[(sizeof(szPre)+sizeof(szPost))/sizeof(WCHAR)+40];
-
-    strcpyW( szRegPath, szPre );
-    MSHTML_guid2wstr( &CLSID_MozillaBrowser, &szRegPath[strlenW(szRegPath)] );
-    strcatW( szRegPath, szPost );
-
-    TRACE("key = %s\n", debugstr_w( szRegPath ) );
-
-    r = RegOpenKeyW( HKEY_LOCAL_MACHINE, szRegPath, &hkey );
-    if( r != ERROR_SUCCESS )
-        return FALSE;
-
-    r = RegQueryValueExW( hkey, NULL, NULL, &type, (LPBYTE)szPath, &sz );
-    ret = ( r == ERROR_SUCCESS ) && ( type == REG_SZ );
-    RegCloseKey( hkey );
-
-    return ret;
-}
-
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 {
-    WCHAR szPath[MAX_PATH];
-
     switch(fdwReason) {
         case DLL_PROCESS_ATTACH:
-            if(MSHTML_GetMozctlPath(szPath, sizeof szPath)) {
-                hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-                if(!hMozCtl)
-                    ERR("Can't load the Mozilla ActiveX control\n");
-            }else {
-                MESSAGE("You need to install the Mozilla ActiveX control to\n");
-                MESSAGE("use Wine's builtin MSHTML dll.\n");
-            }
             hInst = hInstDLL;
 	    break;
 	case DLL_PROCESS_DETACH:
-            if(hMozCtl)
-                FreeLibrary( hMozCtl );
+            close_gecko();
 	    break;
     }
     return TRUE;
@@ -205,20 +141,6 @@ static HRESULT ClassFactory_Create(REFII
 HRESULT WINAPI MSHTML_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
     HRESULT hres;
-    fnGetClassObject pGetClassObject;
-
-    TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv );
-
-    if(hMozCtl && IsEqualGUID(&CLSID_HTMLDocument, rclsid)) {
-        pGetClassObject = (fnGetClassObject) GetProcAddress(hMozCtl, "DllGetClassObject");
-        if(pGetClassObject) {
-            hres = pGetClassObject(&CLSID_MozillaBrowser, riid, ppv);
-            if(SUCCEEDED(hres)) {
-                TRACE("returning Mozilla ActiveX Control hres = %08lx  *ppv = %p\n", hres, *ppv);
-                return hres;
-            }
-        }
-    }
 
     if(IsEqualGUID(&CLSID_HTMLDocument, rclsid)) {
         hres = ClassFactory_Create(riid, ppv, HTMLDocument_Create);
@@ -232,21 +154,8 @@ HRESULT WINAPI MSHTML_DllGetClassObject(
 
 HRESULT WINAPI MSHTML_DllCanUnloadNow(void)
 {
-    fnCanUnloadNow pCanUnloadNow = NULL;
-    HRESULT hres;
-
-    TRACE("()\n");
-
-    if(hMozCtl)
-        pCanUnloadNow = (fnCanUnloadNow) GetProcAddress(hMozCtl, "DllCanUnloadNow");
-    if(!pCanUnloadNow)
-        return S_FALSE;
-
-    hres = pCanUnloadNow();
-
-    TRACE("hres = %08lx\n", hres);
-
-    return hres;
+    FIXME("()\n");
+    return S_FALSE;
 }
 
 /* appears to have the same prototype as WinMain */
Index: dlls/mshtml/mshtml_private.h
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/mshtml_private.h,v
retrieving revision 1.6
diff -u -p -r1.6 mshtml_private.h
--- dlls/mshtml/mshtml_private.h	15 Apr 2005 16:12:45 -0000	1.6
+++ dlls/mshtml/mshtml_private.h	17 Apr 2005 20:50:52 -0000
@@ -16,7 +16,37 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "nsiface.h"
+
+#define NS_OK                     ((nsresult)0x00000000L)
+#define NS_NOINTERFACE            ((nsresult)0x80004002L)
+#define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
+
+#define NS_FAILED(res) ((res) & 0x80000000)
+#define NS_SUCCEEDED(res) (!NS_FAILED(res))
+
+typedef struct HTMLDocument HTMLDocument;
+
 typedef struct {
+    const nsIWebBrowserChromeVtbl    *lpWebBrowserChromeVtbl;
+    const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
+
+    HTMLDocument *doc;
+
+    nsIWebBrowser *webbrowser;
+    nsIWebNavigation *navigation;
+    nsIBaseWindow *window;
+
+    LPWSTR url;
+} NSContainer;
+
+#define NSWBCHROME(x) ((nsIWebBrowserChrome*)    &(x)->lpWebBrowserChromeVtbl)
+#define NSEMBSW(x)    ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
+
+NSContainer* NSContainer_Create(HTMLDocument *pdoc);
+void NSContainer_Destroy(NSContainer *This);
+
+struct HTMLDocument {
     IHTMLDocument2Vtbl          *lpHTMLDocument2Vtbl;
     IPersistMonikerVtbl         *lpPersistMonikerVtbl;
     IPersistFileVtbl            *lpPersistFileVtbl;
@@ -28,12 +58,14 @@ typedef struct {
 
     ULONG ref;
 
+    NSContainer *nscontainer;
+
     IOleClientSite *client;
     IOleInPlaceSite *ipsite;
     IOleInPlaceFrame *frame;
 
     HWND hwnd;
-} HTMLDocument;
+};
 
 #define HTMLDOC(x)       ((IHTMLDocument2*)          &(x)->lpHTMLDocument2Vtbl)
 #define PERSIST(x)       ((IPersist*)                &(x)->lpPersistFileVtbl)
@@ -50,5 +82,7 @@ HRESULT HTMLDocument_Create(IUnknown*,RE
 void HTMLDocument_Persist_Init(HTMLDocument*);
 void HTMLDocument_OleObj_Init(HTMLDocument*);
 void HTMLDocument_View_Init(HTMLDocument*);
+
+void close_gecko();
 
 extern HINSTANCE hInst;
Index: dlls/mshtml/persist.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/persist.c,v
retrieving revision 1.2
diff -u -p -r1.2 persist.c
--- dlls/mshtml/persist.c	12 Apr 2005 11:57:51 -0000	1.2
+++ dlls/mshtml/persist.c	17 Apr 2005 20:50:52 -0000
@@ -78,7 +78,33 @@ static HRESULT WINAPI PersistMoniker_IsD
 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
         IMoniker *pimkName, LPBC pibc, DWORD grfMode)
 {
-    FIXME("(%p)->(%x %p %p %08lx)\n", iface, fFullyAvailable, pimkName, pibc, grfMode);
+    PERSISTMON_THIS
+    LPWSTR url;
+    HRESULT hres;
+    nsresult nsres;
+
+    FIXME("(%p)->(%x %p %p %08lx)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
+
+    hres = IMoniker_GetDisplayName(pimkName, pibc, NULL, &url);
+    if(FAILED(hres))
+        return hres;
+    TRACE("got url: %s\n", debugstr_w(url));
+
+    /* FIXME:
+     * This is a HACK, we should use moniker's BindToStorage instead of gecko's LoadURI.
+     */
+    if(This->nscontainer) {
+        if(This->nscontainer->window) {
+            nsres = nsIWebNavigation_LoadURI(This->nscontainer->navigation, url, LOAD_FLAGS_NONE, NULL, NULL, NULL);
+            if(NS_FAILED(nsres))
+                WARN("LoadURI failed: %08lx\n", nsres);
+        }else {
+            This->nscontainer->url = url;
+        }
+    }else {
+        HeapFree(GetProcessHeap(), 0, url);
+    }
+
     return S_OK;
 }
 
Index: dlls/mshtml/view.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/view.c,v
retrieving revision 1.3
diff -u -p -r1.3 view.c
--- dlls/mshtml/view.c	15 Apr 2005 16:12:45 -0000	1.3
+++ dlls/mshtml/view.c	17 Apr 2005 20:50:52 -0000
@@ -70,8 +70,35 @@ static void paint_disabled(HWND hwnd) {
 
 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    if(msg == WM_PAINT)
-        paint_disabled(hwnd);
+    HTMLDocument *This;
+    nsresult nsres;
+
+    static const WCHAR wszTHIS[] = {'T','H','I','S',0};
+
+    if(msg == WM_CREATE) {
+        This = *(HTMLDocument**)lParam;
+        TRACE("(%p)->(WM_CREATE)\n", This);
+        SetPropW(hwnd, wszTHIS, This);
+    }else {
+        This = (HTMLDocument*)GetPropW(hwnd, wszTHIS);
+    }
+
+    switch(msg) {
+    case WM_PAINT:
+        TRACE("(%p)->(WM_PAINT)\n", This);
+        if(!This->nscontainer) 
+            paint_disabled(hwnd);
+        break;
+    case WM_SIZE:
+        TRACE("(%p)->(WM_SIZE)\n", This);
+        if(This->nscontainer && This->nscontainer->window) {
+            nsres = nsIBaseWindow_SetSize(This->nscontainer->window,
+                    LOWORD(lParam), HIWORD(lParam), TRUE);
+            if(NS_FAILED(nsres))
+                WARN("SetSize failed: %08lx\n", nsres);
+        }
+        break;
+    };
         
     return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
@@ -90,6 +117,68 @@ static void register_serverwnd_class()
     serverwnd_class = RegisterClassExW(&wndclass);
 }
 
+static void activate_container(HTMLDocument *This, LPRECT rect) {
+    nsIWebBrowserSetup *wbsetup;
+    nsresult nsres;
+
+    if(!This->nscontainer)
+        return;
+
+    if(!This->nscontainer->window) {
+        nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser, &IID_nsIBaseWindow,
+                (void**)&This->nscontainer->window);
+        if(NS_FAILED(nsres)) {
+            ERR("Could not get nsIBaseWindow interface: %08lx\n", nsres);
+            return;
+        }
+    }
+
+    nsres = nsIWebBrowser_SetContainerWindow(This->nscontainer->webbrowser, NSWBCHROME(This->nscontainer));
+    if(NS_SUCCEEDED(nsres)) {
+        nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser,
+                &IID_nsIWebBrowserSetup, (void**)&wbsetup);
+        if(NS_SUCCEEDED(nsres)) {
+            nsres = nsIWebBrowserSetup_SetProperty(wbsetup, SETUP_IS_CHROME_WRAPPER, TRUE);
+            if(NS_FAILED(nsres))
+                ERR("SetProperty failed: %08lx\n", nsres);
+            nsIWebBrowserSetup_Release(wbsetup);
+        }else {
+            ERR("Could not get nsIWebBrowserSetup interface\n");
+        }
+        nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser,
+                &IID_nsIBaseWindow, (void**)&This->nscontainer->window);
+        if(NS_SUCCEEDED(nsres)) {
+            nsres = nsIBaseWindow_InitWindow(This->nscontainer->window, This->hwnd, NULL,
+                    0, 0, rect->right, rect->bottom);
+            if(nsres == NS_OK) {
+                nsres = nsIBaseWindow_Create(This->nscontainer->window);
+                if(NS_FAILED(nsres))
+                    ERR("Creating window failed: %08lx\n", nsres);
+                nsres = nsIBaseWindow_SetVisibility(This->nscontainer->window, TRUE);
+                if(NS_FAILED(nsres))
+                    ERR("SetVisibility failed: %08lx\n", nsres);
+                nsIBaseWindow_SetEnabled(This->nscontainer->window, TRUE);
+                if(NS_FAILED(nsres))
+                    ERR("SetEnabled failes: %08lx\n", nsres);
+            }else {
+                ERR("Initializing window failed: %08lx\n", nsres);
+            }
+        }else {
+            ERR("Could not get nsIBaseWindow interface: %08lx\n", nsres);
+        }
+    }else {
+        WARN("SetContainerWindow failed: %08lx\n", nsres);
+    }
+
+    if(This->nscontainer->url) {
+        nsres = nsIWebNavigation_LoadURI(This->nscontainer->navigation, This->nscontainer->url,
+                LOAD_FLAGS_NONE, NULL, NULL, NULL);
+        if(NS_FAILED(nsres))
+            WARN("LoadURI failed: %08lx\n", nsres);
+        HeapFree(GetProcessHeap(), 0, This->nscontainer->url);
+        This->nscontainer->url = NULL;
+    }
+}
 
 /**********************************************************
  * IOleDocumentView implementation
@@ -211,7 +300,7 @@ static HRESULT WINAPI OleDocumentView_Sh
     TRACE("(%p)->(%x)\n", This, fShow);
 
     if(This->hwnd)
-        ShowWindow(This->hwnd, fShow);
+        ShowWindow(This->hwnd, fShow ? SW_SHOW : SW_HIDE);
 
     return S_OK;
 }
@@ -297,6 +386,8 @@ static HRESULT WINAPI OleDocumentView_UI
             IOleInPlaceFrame_Release(This->frame);
         This->frame = pIPFrame;
         This->hwnd = hwnd;
+
+        activate_container(This, &posrect);
     }else {
         static const WCHAR wszEmpty[] = {0};
     
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/mshtml/nsiface.idl	2005-04-17 22:52:17.000000000 +0200
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2005 Jacek Caban
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* 
+ * NOTE:
+ * This file is not an usual idl file. Interfaces in this file are XPCOM interfaces
+ * (NOT MSCOM!), but we generate the header file compatibile with XPCOM by WIDL.
+ * The main reason to do this is that we have to use them in the C code.
+ */
+
+import "wtypes.idl";
+
+typedef HRESULT nsresult;
+typedef ULONG nsrefcnt;
+
+typedef IID nsIID;
+typedef nsIID nsCID;
+typedef REFIID nsIIDRef;
+typedef nsIIDRef nsCIDRef;
+
+typedef void** nsQIResult;
+typedef LPSTR nsstring;
+typedef WCHAR PRUnichar;
+typedef LPWSTR nswstring;
+typedef ULONG PRUint32;
+typedef LONG PRInt32;
+typedef BOOL PRBool;
+
+interface nsIWebBrowserChrome;
+
+[
+    object,
+    uuid(00000000-0000-0000-c000-000000000046)
+]
+interface nsISupports
+{
+    nsresult QueryInterface([in] nsIIDRef riid, [out] nsQIResult result);
+    nsrefcnt AddRef();
+    nsrefcnt Release();
+}
+
+/* Currently we don't need a full declaration of this interfaces */
+typedef nsISupports nsIWeakReference;
+typedef nsISupports nsIURIContentListener;
+typedef nsISupports nsIDOMWindow;
+typedef nsISupports nsIInputStream;
+typedef nsISupports nsIDOMDocument;
+typedef nsISupports nsIURI;
+typedef nsISupports nsISHistory;
+
+[
+    object,
+    uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)
+]
+interface nsIServiceManager : nsISupports
+{
+    void getService([in] nsCIDRef aClass, [in] nsIIDRef aIID, [out] nsQIResult result);
+    void getServiceByContactID([in] nsstring aContactID, [in] nsIIDRef aIID,
+            [out] nsQIResult result);
+    BOOL isServiceInstantiated([in] nsCIDRef aClass, [in] nsIIDRef aIID);
+    BOOL isServiceInstantiatedByContractID([in] nsstring aContractID, [in] nsIIDRef aIID);
+}
+
+[
+    object,
+    uuid(db242e01-e4d9-11d2-9dde-000064657374)
+]
+interface nsIObserver : nsISupports
+{
+    nsresult Observe([in] nsISupports *aSubject, [in] nsstring aTopic, [in] nswstring aData);
+}
+
+[
+    object,
+    uuid(a88e5a60-205a-4bb1-94e1-2628daf51eae)
+]
+interface nsIComponentManager : nsISupports
+{
+    nsresult GetClassObject([in] nsCIDRef aClass, [in] nsIIDRef aIID, [out] nsQIResult result);
+    nsresult GetClassObjectByContractID([in] nsstring aContractID, [in] nsIIDRef aIID,
+            [out] nsQIResult result);
+    nsresult CreateInstance([in] nsCIDRef aClass, [in] nsISupports *aDelegate, [in] nsIIDRef aIID,
+            [out] nsQIResult result);
+    nsresult CreateInstanceByContractID([in] nsstring aContractID, [in] nsISupports *aDelegate,
+            [in] nsIIDRef aIID, [out] nsQIResult result);
+}
+
+[
+    object,
+    uuid(69e5df00-7b8b-11d3-af61-00a024ffc08c)
+]
+interface nsIWebBrowser : nsISupports
+{
+    nsresult AddWebBrowserListener(nsIWeakReference *aListener, const nsIID *aIID);
+    nsresult RemoveWebBrowserListener(nsIWeakReference *aListener, const nsIID *aIID);
+    nsresult GetContainerWindow(nsIWebBrowserChrome **aContainerWindow);
+    nsresult SetContainerWindow(nsIWebBrowserChrome *aContainerWindow);
+    nsresult GetParentURIContentListener(nsIURIContentListener **aParentURIContentListener);
+    nsresult SetParentURIContentListener(nsIURIContentListener *aParentURIContentListener);
+    nsresult GetContentDOMWindow(nsIDOMWindow **aContentDOMWindow);
+}
+
+[
+    object,
+    uuid(ba434c60-9d52-11d3-afb0-00a024ffc08c)
+]
+interface nsIWebBrowserChrome : nsISupports
+{
+    nsresult SetStatus([in] PRUint32 statusType, [in] const PRUnichar *status);
+    nsresult GetWebBrowser(nsIWebBrowser **aWebBrowser);
+    nsresult SetWebBrowser(nsIWebBrowser *aWebBrowser);
+    nsresult GetChromeFlags(PRUint32 *aChromeFlags);
+    nsresult SetChromeFlags(PRUint32 aChromeFlags);
+    nsresult DestroyBrowserWindow();
+    nsresult SizeBrowserTo(PRInt32 aCX, PRInt32 aCY);
+    nsresult ShowAsModal();
+    nsresult IsWindowModal(PRBool *_retval);
+    nsresult ExitModalEventLoop(nsresult aStatus);
+}
+
+[
+    object,
+    uuid(3e5432cd-9568-4bd1-8cbe-d50aba110743)
+]
+interface nsIEmbeddingSiteWindow : nsISupports
+{
+    nsresult SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy);
+    nsresult GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy);
+    nsresult SetFocus();
+    nsresult GetVisibility(PRBool *aVisibility);
+    nsresult SetVisibility(PRBool aVisibility);
+    nsresult GetTitle(PRUnichar **aTitle);
+    nsresult SetTitle(const PRUnichar *aTitle);
+    nsresult GetSiteWindow(void **aSiteWindow);
+}
+
+cpp_quote("#define SETUP_IS_CHROME_WRAPPER 7");
+
+[
+    object,
+    uuid(f15398a0-8018-11d3-af70-00a024ffc08c)
+]
+interface nsIWebBrowserSetup : nsISupports
+{
+    nsresult SetProperty(PRUint32 aId, PRUint32 aValue);
+}
+
+typedef void* nativeWindow;
+typedef void* nsIWidget;
+
+[
+    object,
+    uuid(046bc8a0-8015-11d3-af70-00a024ffc08c)
+]
+interface nsIBaseWindow : nsISupports
+{
+    nsresult InitWindow(nativeWindow parentNativeWindow, nsIWidget *parentWidget, PRInt32 x,
+            PRInt32 y, PRInt32 cx, PRInt32 cy);
+    nsresult Create();
+    nsresult Destroy();
+    nsresult SetPosition(PRInt32 x, PRInt32 y);
+    nsresult GetPosition(PRInt32 *x, PRInt32 *y);
+    nsresult SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint);
+    nsresult GetSize(PRInt32 *cx, PRInt32 *cy);
+    nsresult SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint);
+    nsresult GetPositionAndSize(PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy);
+    nsresult Repaint(PRBool force);
+    nsresult GetParentWidget(nsIWidget **aParentWidget); 
+    nsresult SetParentWidget(nsIWidget *aParentWidget);
+    nsresult GetParentNativeWindow(nativeWindow *aParentNativeWindow);
+    nsresult SetParentNativeWindow(nativeWindow aParentNativeWindow);
+    nsresult GetVisibility(PRBool *aVisibility);
+    nsresult SetVisibility(PRBool aVisibility);
+    nsresult GetEnabled(PRBool *aEnabled);
+    nsresult SetEnabled(PRBool aEnabled);
+    nsresult GetBlurSuppression(PRBool *aBlurSuppression);
+    nsresult SetBlurSuppression(PRBool aBlurSuppression);
+    nsresult GetMainWidget(nsIWidget **aMainWidget);
+    nsresult SetFocus();
+    nsresult GetTitle(PRUnichar **aTitle);
+    nsresult SetTitle(const PRUnichar *aTitle);
+}
+
+cpp_quote("#define LOAD_FLAGS_NONE 0");
+
+[
+    object,
+    uuid(f5d9e7b0-d930-11d3-b057-00a024ffc08c)
+]
+interface nsIWebNavigation : nsISupports
+{
+    nsresult GetCanGoBack(PRBool *aCanGoBack);
+    nsresult GetCanGoForward(PRBool *aCanGoForward);
+    nsresult GoBack();
+    nsresult GoForward();
+    nsresult GotoIndex(PRInt32 index);
+    nsresult LoadURI(const PRUnichar *aURI, PRUint32 aLoadFlags, nsIURI *aReferrer,
+            nsIInputStream *aPostData, nsIInputStream *aHeaders);
+    nsresult Reload(PRUint32 aReloadFlags);
+    nsresult Stop(PRUint32 aStopFlags);
+    nsresult GetDocument(nsIDOMDocument **aDocument);
+    nsresult GetCurrentURI(nsIURI **aCurrentURI);
+    nsresult GetReferringURI(nsIURI **aReferringURI);
+    nsresult GetSessionHistory(nsISHistory **aSessionHistory);
+    nsresult SetSessionHistory(nsISHistory *aSessionHistory);
+}
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/mshtml/nsembd.c	2005-04-17 19:58:35.000000000 +0200
@@ -0,0 +1,500 @@
+/*
+ * Copyright 2005 Jacek Caban
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "ole2.h"
+#include "docobj.h"
+
+#include "mshtml.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+#include "initguid.h"
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+DEFINE_GUID(CLSID_StartupNotifier, 0x1f59b001,0x02c9,0x11d5,0xae,0x76,0xcc,0x92,0xf7,0xdb,0x9e,0x03);
+DEFINE_GUID(CLSID_nsWebBrowser, 0xf1eac761,0x87e9,0x11d3,0xaf,0x80,0x00,0xa0,0x24,0xff,0xc0,0x8c);
+
+#define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1"
+#define NS_WEBBROWSER_CONTRACTID "@mozilla.org/embedding/browser/nsWebBrowser;1"
+
+#define APPSTARTUP_TOPIC "app-startup"
+
+#define PR_UINT32_MAX 0xffffffff
+
+static const WCHAR mozilla_key_path[] =
+    {'S','o','f','t','w','a','r','e','\\',
+     'm','o','z','i','l','l','a','.','o','r','g','\\',
+     'G','R','E',0};
+
+static const WCHAR wszGreHome[] = {'G','r','e','H','o','m','e',0};
+
+typedef struct {
+    void *d1;
+    PRUint32 d2;
+    void *d3;
+} nsString;
+
+/* Currently we don't need a full declaration */
+typedef int nsIFile;
+
+static nsresult (*NS_InitXPCOM2)(nsIServiceManager**,void*,void*);
+static nsresult (*NS_ShutdownXPCOM)(nsIServiceManager*);
+static nsresult (*NS_StringContainerInit)(nsString*);
+static nsresult (*NS_StringContainerFinish)(nsString*);
+static nsresult (*NS_StringSetData)(nsString*,const PRUnichar*,PRUint32);
+static nsresult (*NS_NewLocalFile)(const nsString*,PRBool,nsIFile**);
+
+static HINSTANCE xpcom_handle = 0;
+static PRUnichar mozilla_path[MAX_PATH];
+
+static nsIServiceManager *pServMgr = NULL;
+static nsIComponentManager *pCompMgr = NULL;
+
+static BOOL get_path() {
+    DWORD res, type, i;
+    HKEY mozilla_key, hkey;
+    WCHAR key_name[100];
+    BOOL ret = FALSE;
+
+    res = RegOpenKeyW(HKEY_LOCAL_MACHINE, mozilla_key_path, &mozilla_key);
+    if(res != ERROR_SUCCESS) {
+        TRACE("Could not open key %s\n", debugstr_w(mozilla_key_path));
+        return FALSE;
+    }
+
+    for(i=0; !ret && RegEnumKeyW(mozilla_key, i, key_name, sizeof(key_name)/sizeof(WCHAR)) == ERROR_SUCCESS; i++) {
+        RegOpenKeyW(mozilla_key, key_name, &hkey);
+        res = RegQueryValueExW(hkey, wszGreHome, NULL, &type, (LPBYTE)mozilla_path, &type);
+        if(res == ERROR_SUCCESS)
+            ret = TRUE;
+        RegCloseKey(hkey);
+    }
+
+    RegCloseKey(mozilla_key);
+    return ret;
+}
+
+void close_gecko()
+{
+    if(pCompMgr)
+        nsIComponentManager_Release(pCompMgr);
+
+    if(pServMgr)
+        NS_ShutdownXPCOM(pServMgr);
+
+    if(xpcom_handle)
+        FreeLibrary(xpcom_handle);
+}
+
+static void try_load_gecko()
+{
+    nsresult nsres;
+    nsIObserver *pStartNotif;
+    nsString path;
+    nsIFile *moz_dir;
+
+    static BOOL tried_load = FALSE;
+    static const WCHAR strXPCOM[] = {'x','p','c','o','m','.','d','l','l',0};
+
+    TRACE("()\n");
+
+    if(tried_load)
+        return;
+    tried_load = TRUE;
+
+    if(!get_path()) {
+        MESSAGE("Could not load Mozilla. HTML rendering will be disabled.\n");
+        return;
+    }
+    
+    TRACE("found path %s\n", debugstr_w(mozilla_path));
+
+    xpcom_handle = LoadLibraryW(strXPCOM);
+    if(!xpcom_handle) {
+        /* FIXME:
+         * We don't have SetDllDirectory implemented so we have to modify PATH.
+         */
+        WCHAR path_env[MAX_PATH];
+        static WCHAR wszPATH[] = {'P','A','T','H',0};
+        int len;
+
+        GetEnvironmentVariableW(wszPATH, path_env, sizeof(path_env)/sizeof(WCHAR));
+        len = strlenW(path_env);
+        path_env[len++] = ';';
+        strcpyW(path_env+len, mozilla_path);
+        SetEnvironmentVariableW(wszPATH, path_env);
+
+        xpcom_handle = LoadLibraryW(strXPCOM);
+        if(!xpcom_handle) {
+            ERR("Could not load XPCOM: %ld\n", GetLastError());
+            close_gecko();
+            return;
+        }
+    }
+
+#define NS_DLSYM(func) \
+    func = (typeof(func))GetProcAddress(xpcom_handle, #func); \
+    if(!func) \
+        ERR("Could not GetProcAddress(" #func ") failed\n");
+
+    NS_DLSYM(NS_InitXPCOM2)
+    NS_DLSYM(NS_ShutdownXPCOM)
+    NS_DLSYM(NS_StringContainerInit)
+    NS_DLSYM(NS_StringContainerFinish)
+    NS_DLSYM(NS_StringSetData)
+    NS_DLSYM(NS_NewLocalFile)
+
+#undef NS_DLSYM
+
+    nsres = NS_StringContainerInit(&path);
+    if(NS_FAILED(nsres)) {
+        ERR("NS_StringContainerInit failed: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = NS_StringSetData(&path, mozilla_path, PR_UINT32_MAX);
+    if(NS_FAILED(nsres)) {
+        ERR("NS_StringSetData failed: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = NS_NewLocalFile(&path, FALSE, &moz_dir);
+    if(NS_FAILED(nsres)) {
+        ERR("NS_NewLocalFile failed: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = NS_InitXPCOM2(&pServMgr, moz_dir, NULL);
+    if(NS_FAILED(nsres)) {
+        ERR("NS_InitXPCOM2 failed: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = nsIServiceManager_QueryInterface(pServMgr, &IID_nsIComponentManager, (void**)&pCompMgr);
+    if(NS_FAILED(nsres)) {
+        ERR("Could not get nsIComponentManager: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_APPSTARTUPNOTIFIER_CONTRACTID,
+            NULL, &IID_nsIObserver, (void**)&pStartNotif);
+    if(NS_FAILED(nsres)) {
+        ERR("could not get appstartup-notifier: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = nsIObserver_Observe(pStartNotif, NULL, APPSTARTUP_TOPIC, NULL);
+    if(NS_FAILED(nsres)) {
+        ERR("Observe failed: %08lx\n", nsres);
+        close_gecko();
+        return;
+    }
+
+    nsres = NS_StringContainerFinish(&path);
+    if(NS_FAILED(nsres))
+        ERR("NS_StringContainerFinish failed: %08lx\n", nsres);
+}
+
+static nsIWebBrowser* ns_create_webbrowser()
+{
+    nsIWebBrowser *ret;
+    nsresult nsres;
+
+    try_load_gecko();
+    
+    if(!pCompMgr)
+        return NULL;
+
+    nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr,
+            NS_WEBBROWSER_CONTRACTID, NULL, &IID_nsIWebBrowser, (void**)&ret);
+    if(NS_FAILED(nsres)) {
+        ERR("Creating WebBrowser failed: %08lx\n", nsres);
+        return NULL;
+    }
+
+    TRACE("ending\n");
+
+    return ret;
+}
+
+/**********************************************************
+ * nsIWebBrowserChrome implementation
+ */
+#define NSWBCHROME_THIS \
+    NSContainer* const This=(NSContainer*)((char*)(iface)-offsetof(NSContainer,lwebbrowserChromeVtbl));
+
+static nsresult WINAPI NSWBChrome_QueryInterface(nsIWebBrowserChrome *iface, nsIIDRef riid,
+        void **ppvObject)
+{
+    NSContainer *This = (NSContainer*)iface;
+
+    *ppvObject = NULL;
+    if(IsEqualGUID(&IID_nsISupports, riid)) {
+        TRACE("(%p)->(IID_nsISupports, %p)\n", This, ppvObject);
+        *ppvObject = NSWBCHROME(This);
+    }else if(IsEqualGUID(&IID_nsIWebBrowserChrome, riid)) {
+        TRACE("(%p)->(IID_nsIWebBrowserChrome, %p)\n", This, ppvObject);
+        *ppvObject = NSWBCHROME(This);
+    }else if(IsEqualGUID(&IID_nsIEmbeddingSiteWindow, riid)) {
+        TRACE("(%p)->(IID_nsIEmbeddingSiteWindow, %p)\n", This, ppvObject);
+        *ppvObject = NSEMBSW(This);
+    }
+
+    if(*ppvObject) {
+        nsIWebBrowserChrome_AddRef(iface);
+        return NS_OK;
+    }
+
+    TRACE("(%p)->(%s %p): not supported interface\n", iface, debugstr_guid(riid), ppvObject);
+    return NS_NOINTERFACE;
+}
+
+static nsrefcnt WINAPI NSWBChrome_AddRef(nsIWebBrowserChrome *iface)
+{
+    NSContainer *This = (NSContainer*)iface;
+    TRACE("(%p)\n", iface);
+    return IHTMLDocument2_AddRef(HTMLDOC(This->doc));
+}
+
+static nsrefcnt WINAPI NSWBChrome_Release(nsIWebBrowserChrome *iface)
+{
+    NSContainer *This = (NSContainer*)iface;
+    TRACE("(%p)\n", iface);
+    return IHTMLDocument2_Release(HTMLDOC(This->doc));
+}
+
+static nsresult WINAPI NSWBChrome_SetStatus(nsIWebBrowserChrome *iface, PRUint32 statusType, const PRUnichar *status)
+{
+    WARN("(%p)->(%ld %s)\n", iface, statusType, debugstr_w(status));
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_GetWebBrowser(nsIWebBrowserChrome *iface, nsIWebBrowser **aWebBrowser)
+{
+    WARN("(%p)->(%p)\n", iface, aWebBrowser);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_SetWebBrowser(nsIWebBrowserChrome *iface, nsIWebBrowser *aWebBrowser)
+{
+    WARN("(%p)->(%p)\n", iface, aWebBrowser);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_GetChromeFlags(nsIWebBrowserChrome *iface, PRUint32 *aChromeFlags)
+{
+    WARN("(%p)->(%p)\n", iface, aChromeFlags);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_SetChromeFlags(nsIWebBrowserChrome *iface, PRUint32 aChromeFlags)
+{
+    WARN("(%p)->(%08lx)\n", iface, aChromeFlags);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_DestroyBrowserWindow(nsIWebBrowserChrome *iface)
+{
+    WARN("(%p)\n", iface);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_SizeBrowserTo(nsIWebBrowserChrome *iface, PRInt32 aCX, PRInt32 aCY)
+{
+    WARN("(%p)->(%ld %ld)\n", iface, aCX, aCY);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_ShowAsModal(nsIWebBrowserChrome *iface)
+{
+    WARN("(%p)\n", iface);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_IsWindowModal(nsIWebBrowserChrome *iface, PRBool *_retval)
+{
+    WARN("(%p)->(%p)\n", iface, _retval);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSWBChrome_ExitModalEventLoop(nsIWebBrowserChrome *iface, nsresult aStatus)
+{
+    WARN("(%p)->(%08lx)\n", iface, aStatus);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static const nsIWebBrowserChromeVtbl NSWBChromeVtbl = {
+    NSWBChrome_QueryInterface,
+    NSWBChrome_AddRef,
+    NSWBChrome_Release,
+    NSWBChrome_SetStatus,
+    NSWBChrome_GetWebBrowser,
+    NSWBChrome_SetWebBrowser,
+    NSWBChrome_GetChromeFlags,
+    NSWBChrome_SetChromeFlags,
+    NSWBChrome_DestroyBrowserWindow,
+    NSWBChrome_SizeBrowserTo,
+    NSWBChrome_ShowAsModal,
+    NSWBChrome_IsWindowModal,
+    NSWBChrome_ExitModalEventLoop
+};
+
+/**********************************************************
+ * nsIEmbeddingSiteWindow implementation
+  */
+#define NSESW_THIS \
+    NSContainer* const This=(NSContainer*)((char*)(iface)-offsetof(NSContainer,lpEmbeddingSiteWindowVtbl));
+
+static nsresult WINAPI NSEmbdSiteWin_QueryInterface(nsIEmbeddingSiteWindow *iface,
+        nsIIDRef riid, void **ppvObject)
+{
+    NSESW_THIS
+    return nsIWebBrowserChrome_QueryInterface(NSWBCHROME(This), riid, ppvObject);
+}
+
+static nsrefcnt WINAPI NSEmbdSiteWin_AddRef(nsIEmbeddingSiteWindow *iface)
+{
+    NSESW_THIS
+    return nsIWebBrowserChrome_AddRef(NSWBCHROME(This));
+}
+
+static nsrefcnt WINAPI NSEmbdSiteWin_Release(nsIEmbeddingSiteWindow *iface)
+{
+    NSESW_THIS
+    return nsIWebBrowserChrome_Release(NSWBCHROME(This));
+}
+
+static nsresult WINAPI NSEmbdSiteWin_SetDimensions(nsIEmbeddingSiteWindow *iface,
+        PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
+{
+    WARN("(%p)->(%08lx %ld %ld %ld %ld)\n", iface, flags, x, y, cx, cy);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_GetDimensions(nsIEmbeddingSiteWindow *iface,
+        PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
+{
+    WARN("(%p)->(%08lx %p %p %p %p)\n", iface, flags, x, y, cx, cy);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_SetFocus(nsIEmbeddingSiteWindow *iface)
+{
+    WARN("(%p)", iface);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_GetVisibility(nsIEmbeddingSiteWindow *iface, PRBool *aVisibility)
+{
+    WARN("(%p)->(%p)\n", iface, aVisibility);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_SetVisibility(nsIEmbeddingSiteWindow *iface, PRBool aVisibility)
+{
+    WARN("(%p)->(%x)\n", iface, aVisibility);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_GetTitle(nsIEmbeddingSiteWindow *iface, PRUnichar **aTitle)
+{
+    WARN("(%p)->(%p)\n", iface, aTitle);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_SetTitle(nsIEmbeddingSiteWindow *iface, const PRUnichar *aTitle)
+{
+    WARN("(%p)->(%s)\n", iface, debugstr_w(aTitle));
+    return NS_OK;
+}
+
+static nsresult WINAPI NSEmbdSiteWin_GetSiteWindow(nsIEmbeddingSiteWindow *iface, void **aSiteWindow)
+{
+    WARN("(%p)->(%p)\n", iface, aSiteWindow);
+    return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+static const nsIEmbeddingSiteWindowVtbl NSEmbdSiteWinVtbl = {
+    NSEmbdSiteWin_QueryInterface,
+    NSEmbdSiteWin_AddRef,
+    NSEmbdSiteWin_Release,
+    NSEmbdSiteWin_SetDimensions,
+    NSEmbdSiteWin_GetDimensions,
+    NSEmbdSiteWin_SetFocus,
+    NSEmbdSiteWin_GetVisibility,
+    NSEmbdSiteWin_SetVisibility,
+    NSEmbdSiteWin_GetTitle,
+    NSEmbdSiteWin_SetTitle,
+    NSEmbdSiteWin_GetSiteWindow,
+};
+
+NSContainer* NSContainer_Create(HTMLDocument *pdoc)
+{
+    NSContainer *ret;
+    nsIWebBrowser *nswb;
+    nsresult nsres;
+
+    nswb = ns_create_webbrowser();
+    if(!nswb)
+        return NULL;
+
+    ret = HeapAlloc(GetProcessHeap(), 0, sizeof(NSContainer));
+    ret->lpWebBrowserChromeVtbl = &NSWBChromeVtbl;
+    ret->lpEmbeddingSiteWindowVtbl = &NSEmbdSiteWinVtbl;
+    ret->doc = pdoc;
+    ret->webbrowser = nswb;
+
+    nsres = nsIWebBrowser_QueryInterface(ret->webbrowser, &IID_nsIWebNavigation, (void**)&ret->navigation);
+    if(NS_FAILED(nsres))
+        ERR("Could not get nsIWebNavigation interface: %08lx\n", nsres);
+
+    ret->window = NULL;
+    ret->url = NULL;
+
+    return ret;
+}
+
+void NSContainer_Destroy(NSContainer *This)
+{
+    nsIWebBrowser_Release(This->webbrowser);
+    nsIWebNavigation_Release(This->navigation);
+    if(This->window)
+        nsIBaseWindow_Release(This->window);
+    HeapFree(GetProcessHeap(), 0, This);
+}
+


More information about the wine-devel mailing list