From f8f85a7b78e65431f2d2872b1b0dc40ee1e2d24f Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Thu, 17 Aug 2000 19:54:43 +0000 Subject: [PATCH] bug=49293 r=gbarney a=edburns M classes_spec/org/mozilla/webclient/test/EMWindow.java A src_ie/CMyDialog.cpp A src_ie/CMyDialog.h M src_ie/CurrentPageImpl.cpp M src_ie/HistoryImpl.cpp M src_ie/Makefile.win M src_ie/NativeEventThread.cpp M src_ie/WindowControlImpl.cpp M src_ie/WrapperFactoryImpl.cpp M src_ie/ie_util.cpp M src_ie/ie_util.h cvs diff -u classes_spec/org/mozilla/webclient/test/EMWindow.java src_ie/CMyDialog.cpp src_ie/CMyDialog.h src_ie/CurrentPageImpl.cpp src_ie/HistoryImpl.cpp src_ie/Makefile.win src_ie/NativeEventThread.cpp src_ie/WindowControlImpl.cpp src_ie/WrapperFactoryImpl.cpp src_ie/ie_util.cpp src_ie/ie_util.h This change adds listener DocumentLoadListener support to src_ie. tar -cvf 49293.tar classes_spec/org/mozilla/webclient/test/EMWindow.java src_ie/CMyDialog.cpp src_ie/CMyDialog.h src_ie/CurrentPageImpl.cpp src_ie/HistoryImpl.cpp src_ie/Makefile.win src_ie/NativeEventThread.cpp src_ie/WindowControlImpl.cpp src_ie/WrapperFactoryImpl.cpp src_ie/ie_util.cpp src_ie/ie_util.h git-svn-id: svn://10.0.0.236/trunk@76568 18797224-902f-48f8-a5cc-f745e15eee43 --- .../org/mozilla/webclient/test/EMWindow.java | 4 +- mozilla/java/webclient/src_ie/CMyDialog.cpp | 108 +++++++++ mozilla/java/webclient/src_ie/CMyDialog.h | 76 ++++++ .../java/webclient/src_ie/CurrentPageImpl.cpp | 7 + mozilla/java/webclient/src_ie/HistoryImpl.cpp | 8 +- mozilla/java/webclient/src_ie/Makefile.win | 5 +- .../webclient/src_ie/NativeEventThread.cpp | 222 ++++++++---------- .../webclient/src_ie/WindowControlImpl.cpp | 7 +- .../webclient/src_ie/WrapperFactoryImpl.cpp | 1 + mozilla/java/webclient/src_ie/ie_util.cpp | 15 ++ mozilla/java/webclient/src_ie/ie_util.h | 32 ++- 11 files changed, 350 insertions(+), 135 deletions(-) create mode 100644 mozilla/java/webclient/src_ie/CMyDialog.cpp create mode 100644 mozilla/java/webclient/src_ie/CMyDialog.h diff --git a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java index f90b60cc4a6..972d8ffed1b 100644 --- a/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java +++ b/mozilla/java/webclient/classes_spec/org/mozilla/webclient/test/EMWindow.java @@ -51,7 +51,7 @@ import org.w3c.dom.Document; * This is a test application for using the BrowserControl. * - * @version $Id: EMWindow.java,v 1.16 2000-07-07 18:47:25 edburns%acm.org Exp $ + * @version $Id: EMWindow.java,v 1.17 2000-08-17 19:54:43 edburns%acm.org Exp $ * * @see org.mozilla.webclient.BrowserControlFactory @@ -535,7 +535,7 @@ public void eventDispatched(WebclientEvent event) statusLabel.setText("Done."); currentDocument = currentPage.getDOM(); // add the new document to the domViewer - if (null != domViewer) { + if (null != currentDocument && null != domViewer) { domViewer.setDocument(currentDocument); } diff --git a/mozilla/java/webclient/src_ie/CMyDialog.cpp b/mozilla/java/webclient/src_ie/CMyDialog.cpp new file mode 100644 index 00000000000..c6453bb2c87 --- /dev/null +++ b/mozilla/java/webclient/src_ie/CMyDialog.cpp @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is RaptorCanvas. + * + * The Initial Developer of the Original Code is Kirk Baker and + * Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are + * Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All + * Rights Reserved. + * + * Contributor(s): Glenn Barney + */ + + +#include "CMyDialog.h" + +CMyDialog::CMyDialog(WebShellInitContext *yourInitContext) : m_initContext(yourInitContext), m_docTarget(NULL), forwardState(JNI_FALSE), backState(JNI_TRUE) +{ + // initialize the string constants (including properties keys) + if (!util_StringConstantsAreInitialized()) { + util_InitStringConstants(m_initContext->env); + } +} + +CMyDialog::~CMyDialog() +{ + m_initContext = NULL; + +} + +void JNICALL CMyDialog::OnCommandStateChange(long lCommand, BOOL bEnable) +{ + + if (CSC_NAVIGATEFORWARD == lCommand) + { + if (bEnable == 0) + forwardState = JNI_FALSE; + if (bEnable == 65535) + forwardState = JNI_TRUE; + } + else if (CSC_NAVIGATEBACK == lCommand) + { + if (bEnable== 0) + backState = JNI_FALSE; + if (bEnable == 65535) + backState = JNI_TRUE; + } +} + +void JNICALL CMyDialog::OnDownloadBegin() +{ +} + +void JNICALL CMyDialog::OnDownloadComplete() +{ +} + +void JNICALL CMyDialog::OnNavigateComplete2(IDispatch* pDisp, CComVariant& URL) +{ + if (m_docTarget) { + util_SendEventToJava(m_initContext->env, + m_initContext->nativeEventThread, m_docTarget, + DOCUMENT_LOAD_LISTENER_CLASSNAME, + DocumentLoader_maskValues[END_DOCUMENT_LOAD_EVENT_MASK], + NULL); + } +} + +jboolean JNICALL CMyDialog::GetForwardState() const +{ + return forwardState; +} + +jboolean JNICALL CMyDialog::GetBackState() const +{ + return backState; +} + +void JNICALL CMyDialog::AddDocumentLoadListener(jobject target) +{ + // PENDING(glenn): do some kind of check to make sure our state is ok. + + if (-1 == DocumentLoader_maskValues[0]) { + util_InitializeEventMaskValuesFromClass("org/mozilla/webclient/DocumentLoadEvent", + DocumentLoader_maskNames, + DocumentLoader_maskValues); + } + m_docTarget = target; +} + + +void JNICALL CMyDialog::RemoveDocumentLoadListener(jobject target) +{ +} + +void JNICALL CMyDialog::RemoveAllListeners() +{ + +} diff --git a/mozilla/java/webclient/src_ie/CMyDialog.h b/mozilla/java/webclient/src_ie/CMyDialog.h new file mode 100644 index 00000000000..09da7cedcdc --- /dev/null +++ b/mozilla/java/webclient/src_ie/CMyDialog.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is RaptorCanvas. + * + * The Initial Developer of the Original Code is Kirk Baker and + * Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are + * Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All + * Rights Reserved. + * + * Contributor(s): Glenn Barney + */ + +#ifndef cmydialog_h +#define cmydialog_h + +#include "ie_util.h" + +/* + + * lifetime: shared with WebShellInitContext + + */ + +class CMyDialog: + + public CAxWindow, + public IDispEventImpl<1, CMyDialog, &DIID_DWebBrowserEvents2,&LIBID_SHDocVw, 1, 0> +{ + + +public: + CMyDialog(WebShellInitContext *yourInitContext); + virtual ~CMyDialog(); + + CComPtr spUnk; + CComPtr m_pWB; + + void JNICALL OnCommandStateChange(long lCommand, BOOL bEnable); + void JNICALL OnDownloadBegin(); + void JNICALL OnDownloadComplete(); + void JNICALL OnNavigateComplete2(IDispatch* pDisp, CComVariant& URL); + + jboolean JNICALL GetForwardState() const; + jboolean JNICALL GetBackState() const; + + void JNICALL AddDocumentLoadListener(jobject target); + void JNICALL RemoveDocumentLoadListener(jobject target); + void JNICALL RemoveAllListeners(); + + + BEGIN_SINK_MAP(CMyDialog) + SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnCommandStateChange) + SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADBEGIN, OnDownloadBegin) + SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete) + SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, OnNavigateComplete2) + END_SINK_MAP() + +protected: + WebShellInitContext *m_initContext; // not the prime-reference, don't delete + jobject m_docTarget; + + jboolean forwardState; + jboolean backState; +}; + +#endif // cmydialog_h diff --git a/mozilla/java/webclient/src_ie/CurrentPageImpl.cpp b/mozilla/java/webclient/src_ie/CurrentPageImpl.cpp index 0dc4e3e4ca8..c9ef809300f 100644 --- a/mozilla/java/webclient/src_ie/CurrentPageImpl.cpp +++ b/mozilla/java/webclient/src_ie/CurrentPageImpl.cpp @@ -74,6 +74,13 @@ JNIEXPORT jstring JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPage return urlString; } +JNIEXPORT jobject JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeGetDOM +(JNIEnv *, jobject, jint) +{ + return NULL; +} + + /* * Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl * Method: nativeGetSource diff --git a/mozilla/java/webclient/src_ie/HistoryImpl.cpp b/mozilla/java/webclient/src_ie/HistoryImpl.cpp index 80bc3804b9a..0f775a5130e 100644 --- a/mozilla/java/webclient/src_ie/HistoryImpl.cpp +++ b/mozilla/java/webclient/src_ie/HistoryImpl.cpp @@ -24,6 +24,8 @@ #include "ie_util.h" #include "ie_globals.h" +#include "CMyDialog.h" + JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeBack (JNIEnv *env, jobject obj, jint webShellPtr) @@ -52,8 +54,8 @@ JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeCanBack } - jboolean result = JNI_TRUE; - + jboolean result = initContext->browserObject->GetBackState(); + return result; } @@ -97,7 +99,7 @@ JNIEXPORT jboolean JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImp return JNI_FALSE; } - jboolean result = JNI_TRUE; + jboolean result = initContext->browserObject->GetForwardState(); return result; } diff --git a/mozilla/java/webclient/src_ie/Makefile.win b/mozilla/java/webclient/src_ie/Makefile.win index 129ab43164f..fc06fd007ac 100644 --- a/mozilla/java/webclient/src_ie/Makefile.win +++ b/mozilla/java/webclient/src_ie/Makefile.win @@ -29,6 +29,9 @@ DLL=.\$(OBJDIR)\$(DLLNAME).dll MODULE=webclient OBJS = \ + .\$(OBJDIR)\ie_util.obj \ + .\$(OBJDIR)\ie_util_export.obj \ + .\$(OBJDIR)\CMyDialog.obj \ .\$(OBJDIR)\BookmarksImpl.obj \ .\$(OBJDIR)\CurrentPageImpl.obj \ .\$(OBJDIR)\HistoryImpl.obj \ @@ -37,8 +40,6 @@ OBJS = \ .\$(OBJDIR)\NavigationImpl.obj \ .\$(OBJDIR)\WindowControlImpl.obj \ .\$(OBJDIR)\WrapperFactoryImpl.obj \ - .\$(OBJDIR)\ie_util_export.obj \ - .\$(OBJDIR)\ie_util.obj \ $(NULL) LCFLAGS = \ diff --git a/mozilla/java/webclient/src_ie/NativeEventThread.cpp b/mozilla/java/webclient/src_ie/NativeEventThread.cpp index dc2f1071279..24a1d6b1634 100644 --- a/mozilla/java/webclient/src_ie/NativeEventThread.cpp +++ b/mozilla/java/webclient/src_ie/NativeEventThread.cpp @@ -29,8 +29,9 @@ #include "ie_globals.h" #include "ie_util.h" +#include "CMyDialog.h" + #include //for CComPtr -#include // for CAppModule decl CAppModule _Module; @@ -42,11 +43,11 @@ #include #include -#include -#include -#include -#include -#include +//#include //WTL +#include //WTL +//#include //WTL +//#include //WTL +//#include #include @@ -56,39 +57,8 @@ #include -#include "prlog.h" // for PR_ASSERT - -#ifdef XP_UNIX -#include -#include "gdksuperwin.h" -#include "gtkmozarea.h" -#endif - -class CMyDialog: - - - public CAxWindow, - public IDispEventImpl<1, CMyDialog, &DIID_DWebBrowserEvents2,&LIBID_SHDocVw, 1, 0> -{ - - -public: - //ComPtr spUnk; - CComPtr m_pWB; - //CAxWindow happyday; - - void __stdcall OnCommandStateChange(long lCommand, BOOL bEnable); - void __stdcall CMyDialog::OnDownloadBegin(); - void __stdcall OnDownloadComplete(); - void __stdcall OnNavigateComplete2(IDispatch* pDisp, CComVariant& URL); - - BEGIN_SINK_MAP(CMyDialog) - SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnCommandStateChange) - SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADBEGIN, OnDownloadBegin) - SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete) - SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, OnNavigateComplete2) - END_SINK_MAP() -}; +HWND localParent; //these two are temporarily being used in order to test the +HWND localChild; //OnCommandStateChange functions, they may be eventually removed // @@ -103,8 +73,6 @@ int processEventLoop(WebShellInitContext *initContext); // Local data // -HWND localParent; //these two are temporarily being used in order to test the -HWND localChild; //OnCommandStateChange functions, they may be eventually removed extern void util_ThrowExceptionToJava (JNIEnv * , const char * ); @@ -117,31 +85,6 @@ char * errorMessages[] = { "Unable to show the WebShell." }; -/** - - * a null terminated array of listener interfaces we support. - - * PENDING(): this should probably live in EventRegistration.h - - * PENDING(edburns): need to abstract this out so we can use it from uno - * and JNI. - - */ - -const char *gSupportedListenerInterfaces[] = { - "org/mozilla/webclient/DocumentLoadListener", - 0 -}; - -// these index into the gSupportedListenerInterfaces array, this should -// also live in EventRegistration.h - -typedef enum { - DOCUMENT_LOAD_LISTENER = 0, - LISTENER_NOT_FOUND -} LISTENER_CLASSES; - - // // JNI methods // @@ -200,9 +143,74 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThr */ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeAddListener -(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener) +(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener, + jstring listenerString) { - printf("debug: glenn: nativeAddListener\n"); + WebShellInitContext *initContext = (WebShellInitContext *)webShellPtr; + + if (initContext == nsnull) { + ::util_ThrowExceptionToJava(env, "Exception: null initContext passed tonativeAddListener"); + return; + } + + if (nsnull == initContext->nativeEventThread) { + // store the java EventRegistrationImpl class in the initContext + initContext->nativeEventThread = + ::util_NewGlobalRef(env, obj); // VERY IMPORTANT!! + + // This enables the listener to call back into java + } + + jclass clazz = nsnull; + int listenerType = 0; + const char *listenerStringChars = ::util_GetStringUTFChars(env, + listenerString); + if (listenerStringChars == nsnull) { + ::util_ThrowExceptionToJava(env, "Exception: nativeAddListener: Can't get className for listener."); + return; + } + + while (nsnull != gSupportedListenerInterfaces[listenerType]) { + if (0 == strcmp(gSupportedListenerInterfaces[listenerType], + listenerStringChars)) { + // We've got a winner! + break; + } + listenerType++; + } + ::util_ReleaseStringUTFChars(env, listenerString, listenerStringChars); + listenerStringChars = nsnull; + + if (LISTENER_NOT_FOUND == (LISTENER_CLASSES) listenerType) { + ::util_ThrowExceptionToJava(env, "Exception: NativeEventThread.nativeAddListener(): can't find listener \n\tclass for argument"); + return; + } + + jobject globalRef = nsnull; + + // PENDING(edburns): make sure do DeleteGlobalRef on the removeListener + if (nsnull == (globalRef = ::util_NewGlobalRef(env, typedListener))) { + ::util_ThrowExceptionToJava(env, "Exception: NativeEventThread.nativeAddListener(): can't create NewGlobalRef\n\tfor argument"); + return; + } + util_Assert(initContext->browserObject); + + switch(listenerType) { + case DOCUMENT_LOAD_LISTENER: + initContext->browserObject->AddDocumentLoadListener(globalRef); + break; + } + + return; + +} + +JNIEXPORT void JNICALL +Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeRemoveListener +(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener, + jstring listenerString) +{ + printf("debug: glenn: nativeRemoveListener\n"); } JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeCleanUp @@ -214,6 +222,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThr //AtlAdviseSinkMap(&browserHome, false) //_Module.RemoveMessageLoop(); + initContext->browserObject->DispEventUnadvise(initContext->browserObject->spUnk); _Module.Term(); ::CoUninitialize(); @@ -225,28 +234,29 @@ int processEventLoop(WebShellInitContext * initContext) HRESULT hr; MSG msg; - + + if (::PeekMessage(&msg, nsnull, 0, 0, PM_NOREMOVE)) { if (::GetMessage(&msg, nsnull, 0, 0)) { switch (msg.message) { case WM_REFRESH: - hr = (initContext->m_pWB)->Refresh(); + hr = (initContext->browserObject->m_pWB)->Refresh(); break; case WM_NAVIGATE: - hr = (initContext->m_pWB)->Navigate(CComBSTR(initContext->wcharURL), NULL, NULL, NULL, NULL); + hr = (initContext->browserObject->m_pWB)->Navigate(CComBSTR(initContext->wcharURL), NULL, NULL, NULL, NULL); free((void *) initContext->wcharURL); - initContext->wcharURL = nsnull; + initContext->wcharURL = NULL; break; case WM_BACK: - hr = (initContext->m_pWB)->GoBack(); + hr = (initContext->browserObject->m_pWB)->GoBack(); break; case WM_FORWARD: - hr = (initContext->m_pWB)->GoForward(); + hr = (initContext->browserObject->m_pWB)->GoForward(); break; case WM_STOP: - hr = (initContext->m_pWB)->Stop(); + hr = (initContext->browserObject->m_pWB)->Stop(); break; case WM_RESIZE : hr = MoveWindow(initContext->browserHost, initContext->x, initContext->y, initContext->w, initContext->h, TRUE); @@ -259,8 +269,9 @@ int processEventLoop(WebShellInitContext * initContext) ::TranslateMessage(&msg); ::DispatchMessage(&msg); } - } - + } + initContext->canForward = initContext->browserObject->GetForwardState(); + initContext->canBack = initContext->browserObject->GetBackState(); return 1; } @@ -296,13 +307,10 @@ HRESULT InitIEStuff (WebShellInitContext * initContext) hRes = _Module.Init(NULL, newInst); ATLASSERT(SUCCEEDED(hRes)); - + + AtlAxWinInit(); - CMyDialog browserHome; - - AtlAxWinInit(); - - m_hWndClient = browserHome.Create( + m_hWndClient = initContext->browserObject->Create( initContext->parentHWnd, rect, _T("about:blank"), @@ -311,13 +319,8 @@ HRESULT InitIEStuff (WebShellInitContext * initContext) WS_EX_CLIENTEDGE, ID_WEBBROWSER); - hr = browserHome.QueryControl(&browserHome.m_pWB); - initContext->m_pWB = browserHome.m_pWB; - - - (initContext->browserHost) = m_hWndClient; - - + hr = initContext->browserObject->QueryControl(&(initContext->browserObject->m_pWB)); + if FAILED(hr) { @@ -332,10 +335,12 @@ HRESULT InitIEStuff (WebShellInitContext * initContext) } -// CComPtr spUnk; //Unk Ptr will be used to sink the map -// hr = browserHome.QueryControl(&spUnk); - - //hr = browserHome.DispEventAdvise(spUnk); + (initContext->browserHost) = m_hWndClient; + + if (!initContext->browserObject->spUnk) { + hr = initContext->browserObject->QueryControl(&(initContext->browserObject->spUnk)); + hr = initContext->browserObject->DispEventAdvise(initContext->browserObject->spUnk); + } if FAILED(hr) { @@ -343,37 +348,10 @@ HRESULT InitIEStuff (WebShellInitContext * initContext) return -1; } - processEventLoop(initContext); + processEventLoop(initContext); return 0; } -void __stdcall CMyDialog::OnCommandStateChange(long lCommand, BOOL bEnable) -{ - - -// HRESULT hr = ::PostMessage(localChild, WM_BIGTEST, 0, 0); -// if (CSC_NAVIGATEFORWARD == lCommand) -// { -// SetForwarders(bEnable, localParent); -// } -// else if (CSC_NAVIGATEBACK == lCommand) -// { -// SetBackers(bEnable, localParent); -// } - -} - -void __stdcall CMyDialog::OnDownloadBegin() -{ -} - -void __stdcall CMyDialog::OnDownloadComplete() -{ -} - -void __stdcall CMyDialog::OnNavigateComplete2(IDispatch* pDisp, CComVariant& URL) -{ -} diff --git a/mozilla/java/webclient/src_ie/WindowControlImpl.cpp b/mozilla/java/webclient/src_ie/WindowControlImpl.cpp index 1dc6b4366e3..0ffff43cbac 100644 --- a/mozilla/java/webclient/src_ie/WindowControlImpl.cpp +++ b/mozilla/java/webclient/src_ie/WindowControlImpl.cpp @@ -26,6 +26,7 @@ #include "ie_util.h" #include "ie_globals.h" +#include "CMyDialog.h" JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeSetBounds @@ -69,7 +70,6 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlI WebShellInitContext* initContext = new WebShellInitContext; - initContext->m_pWB = NULL; initContext->initComplete = FALSE; initContext->initFailCode = 0; initContext->parentHWnd = parentHWnd; @@ -82,6 +82,8 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlI initContext->w = width; initContext->h = height; + initContext->browserObject = new CMyDialog(initContext); + return (jint) initContext; } @@ -114,6 +116,9 @@ Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeDestroyInitCo initContext->w = -1; initContext->h = -1; + delete initContext->browserObject; + initContext->browserObject = NULL; + delete initContext; } diff --git a/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp b/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp index 86bcf89afda..40da07bae05 100644 --- a/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp +++ b/mozilla/java/webclient/src_ie/WrapperFactoryImpl.cpp @@ -64,6 +64,7 @@ const char *gImplementedInterfaces[] = { "webclient.Navigation", "webclient.CurrentPage", "webclient.History", + "webclient.EventRegistration", 0 }; diff --git a/mozilla/java/webclient/src_ie/ie_util.cpp b/mozilla/java/webclient/src_ie/ie_util.cpp index be7c1ae0c7c..c83bfa14272 100644 --- a/mozilla/java/webclient/src_ie/ie_util.cpp +++ b/mozilla/java/webclient/src_ie/ie_util.cpp @@ -21,6 +21,21 @@ */ #include "ie_util.h" + +/** + + * a null terminated array of listener interfaces we support. This is + * used in NativeEventThread.cpp nativeAddListener, + * nativeRemoveListener, and in CBrowserContainer.cpp + + */ + +const char *gSupportedListenerInterfaces[] = { + DOCUMENT_LOAD_LISTENER_CLASSNAME_VALUE, + 0 +}; + + // // Implementations for functions defined in ../src_share/jni_util.h, but not // implemented there. diff --git a/mozilla/java/webclient/src_ie/ie_util.h b/mozilla/java/webclient/src_ie/ie_util.h index 766938d8b0d..48463c1215c 100644 --- a/mozilla/java/webclient/src_ie/ie_util.h +++ b/mozilla/java/webclient/src_ie/ie_util.h @@ -32,15 +32,36 @@ #include "jni_util.h" // located in ../src_share, // pulls in ../src_share/jni_util_export.h - -#include #include +#include //for CComPtr +#include // for CAppModule decl WTL + + +extern CAppModule _Module; +#include // for AtlWin +#include + +//#include + +#include //for IWebBrowser2 +#include + +#include +//#include //WTL +#include //WTL +//#include //WTL +//#include //WTL +//#include +#include + +class CMyDialog; + +extern const char *gSupportedListenerInterfaces[]; // defined in ie_util.cpp struct WebShellInitContext { HWND parentHWnd; HWND browserHost; - CComPtr m_pWB; JNIEnv * env; jobject nativeEventThread; const wchar_t * wcharURL; @@ -50,8 +71,9 @@ struct WebShellInitContext { int y; int w; int h; - bool canForward; - bool canBack; + jboolean canForward; + jboolean canBack; + CMyDialog *browserObject; };