Author=Ronald Capelli <capelli@us.ibm.com>

r=edburns

This checkin makes Webclient run with IE!

Thanks Ron!

Ed
This commit is contained in:
edburns%acm.org 2003-04-12 21:40:35 +00:00
Родитель 47768abcf7
Коммит 6e03bab199
12 изменённых файлов: 396 добавлений и 278 удалений

Просмотреть файл

@ -61,7 +61,7 @@
</path>
<target name="main"
depends="compile.classes_spec,compile.src_share,compile.src_moz,create.webclient.scripts"/>
depends="compile.classes_spec,compile.src_share,compile.src_moz,compile.src_ie,create.webclient.scripts"/>
<target name="compile.classes_spec">
@ -196,6 +196,16 @@
</target>
<target name="compile.src_ie" depends="compile.src_share">
<exec os="Windows 2000" dir="${basedir}/src_ie" executable="make"
failonerror="yes"/>
<exec os="Windows 2000" dir="${basedir}/src_ie" executable="make"
failonerror="yes"/>
</target>
<target name="create.webclient.scripts"
depends="create.win32.webclient.scripts,create.unix.webclient.scripts"/>
@ -257,6 +267,10 @@ ${myenv.MOZ_JDKHOME}/bin/java ${debug.options} org.mozilla.webclient.test.Embedd
failonerror="yes">
<arg line="clobber_all"/>
</exec>
<exec os="Windows 2000" dir="${basedir}/src_ie" executable="make"
failonerror="yes">
<arg line="clobber_all"/>
</exec>
<exec os="SunOS" dir="${basedir}/src_share" executable="gmake"
failonerror="yes">

Просмотреть файл

@ -0,0 +1,86 @@
# 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 mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s): Ron Capelli <capelli@us.ibm.com>
DEPTH = ../../..
topsrcdir = $(DEPTH)
srcdir = $(topsrcdir)/java/webclient/src_ie
VPATH = $(topsrcdir)/java/webclient/src_ie
include $(DEPTH)/config/autoconf.mk
#DIST = $(topsrcdir)/dist
ifneq ($(BAL_INTERFACE),)
LIBRARY_NAME = webclient_bal
else
LIBRARY_NAME = webclient
endif
DLLNAME = webclient.dll
PDBFILE = webclient.pdb
CPPSRCS = \
ie_util.cpp \
ie_util_export.cpp \
BookmarksImpl.cpp \
CMyDialog.cpp \
HistoryImpl.cpp \
CurrentPageImpl.cpp \
ISupportsPeer.cpp \
NativeEventThread.cpp \
NavigationImpl.cpp \
WindowControlImpl.cpp \
WrapperFactoryImpl.cpp \
$(NULL)
CPPSRCS += \
../src_moz/win32/Win32BrowserControlCanvas.cpp \
$(NULL)
_OBJS = $(CPPSRCS:.cpp=.obj)
OBJS = $(strip $(_OBJS))
EXTRA_LIBS = $(DIST)/lib/wc_share.lib
# include $(topsrcdir)/config/rules.mk
INCLUDES := -I$(MOZ_JDKHOME)/include -I$(MOZ_JDKHOME)/include/win32 \
$(INCLUDES) \
-I../src_share -I.
CPP_FLAGS = /nologo /MDd /Zi /W3 /TP /Gy /c $(INCLUDES) /Fd$(PDBFILE)
#MKSHLIB = link /NOLOGO /DLL /OUT:$@ /PDB:$(PDBFILE) /SUBSYSTEM:WINDOWS
LDFLAGS = /DEBUG /DEBUGTYPE:CV
%.obj: %.cpp
cl /Fo$@ $(CPP_FLAGS) $<
all: webclient.dll
$(DLLNAME): $(OBJS) Makefile Makefile.in
rm -f $@
$(MKSHLIB) $(OBJS) $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
clobber_all:: clobber

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- 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
@ -18,11 +18,12 @@
* Rights Reserved.
*
* Contributor(s): Glenn Barney <gbarney@uiuc.edu>
* Ron Capelli <capelli@us.ibm.com>
*/
#define IDD_MYDIALOG 128
#define _WIN32_WINNT 0x0400
#define _WIN32_IE 0x0400
#define _WIN32_IE 0x0400
#include "NativeEventThread.h"
@ -33,8 +34,8 @@
#include <atlbase.h> //for CComPtr
CAppModule _Module;
CComModule _Module;
#include <Atlwin.h> // for AtlWin
#include <Atlcom.h>
@ -44,16 +45,13 @@
#include <atlhost.h>
//#include <atlframe.h>//WTL
#include <atlctrls.h>//WTL
//#include <atlctrls.h>//WTL
//#include <atlctrlw.h>//WTL
//#include <atlmisc.h>//WTL
//#include <atlimpl.cpp>
#include <objbase.h>
#ifdef XP_PC
#include <windows.h>
#endif
#include <stdio.h>
@ -92,33 +90,29 @@ char * errorMessages[] = {
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeInitialize
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (NULL == initContext) {
::util_ThrowExceptionToJava (env,
"NULL webShellPtr passed to nativeInitialize.");
return;
}
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (NULL == initContext) {
::util_ThrowExceptionToJava (env,
"NULL webShellPtr passed to nativeInitialize.");
return;
}
InitIEStuff (initContext);
}
InitIEStuff (initContext);
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeProcessEvents
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (nsnull == initContext) {
::util_ThrowExceptionToJava(env,
::util_ThrowExceptionToJava(env,
"NULL webShellPtr passed to nativeProcessEvents.");
return;
}
processEventLoop(initContext);
}
/**
@ -143,35 +137,35 @@ 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)
{
WebShellInitContext *initContext = (WebShellInitContext *)webShellPtr;
if (initContext == nsnull) {
::util_ThrowExceptionToJava(env, "Exception: null initContext passed tonativeAddListener");
return;
::util_ThrowExceptionToJava(env, "Exception: null initContext passed tonativeAddListener");
return;
}
if (nsnull == initContext->nativeEventThread) {
// store the java EventRegistrationImpl class in the initContext
initContext->nativeEventThread =
initContext->nativeEventThread =
::util_NewGlobalRef(env, obj); // VERY IMPORTANT!!
// This enables the listener to call back into java
// This enables the listener to call back into java
}
jclass clazz = nsnull;
int listenerType = 0;
const char *listenerStringChars = ::util_GetStringUTFChars(env,
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],
if (0 == strcmp(gSupportedListenerInterfaces[listenerType],
listenerStringChars)) {
// We've got a winner!
break;
@ -180,32 +174,31 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThr
}
::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);
initContext->browserObject->AddDocumentLoadListener(globalRef);
break;
}
return;
}
JNIEXPORT void JNICALL
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeRemoveListener
(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener,
jstring listenerString)
@ -216,60 +209,57 @@ Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeRemoveListene
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeCleanUp
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
//AtlAdviseSinkMap(&browserHome, false)
//_Module.RemoveMessageLoop();
//AtlAdviseSinkMap(&browserHome, false)
//_Module.RemoveMessageLoop();
initContext->browserObject->DispEventUnadvise(initContext->browserObject->spUnk);
_Module.Term();
_Module.Term();
::CoUninitialize();
}
int processEventLoop(WebShellInitContext * initContext)
{
HRESULT hr;
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->browserObject->m_pWB)->Refresh();
break;
case WM_NAVIGATE:
hr = (initContext->browserObject->m_pWB)->Navigate(CComBSTR(initContext->wcharURL), NULL, NULL, NULL, NULL);
free((void *) initContext->wcharURL);
initContext->wcharURL = NULL;
break;
case WM_BACK:
hr = (initContext->browserObject->m_pWB)->GoBack();
break;
case WM_FORWARD:
hr = (initContext->browserObject->m_pWB)->GoForward();
break;
case WM_STOP:
hr = (initContext->browserObject->m_pWB)->Stop();
break;
case WM_RESIZE :
hr = MoveWindow(initContext->browserHost, initContext->x, initContext->y, initContext->w, initContext->h, TRUE);
break;
case WM_BIGTEST:
hr = ::MessageBox(initContext->browserHost, "command state changed", "youknow", MB_OK);
break;
}
::TranslateMessage(&msg);
if (::GetMessage(&msg, nsnull, 0, 0)) {
switch (msg.message)
{
case WM_REFRESH:
hr = (initContext->browserObject->m_pWB)->Refresh();
break;
case WM_NAVIGATE:
hr = (initContext->browserObject->m_pWB)->Navigate(CComBSTR(initContext->wcharURL), NULL, NULL, NULL, NULL);
free((void *) initContext->wcharURL);
initContext->wcharURL = NULL;
break;
case WM_BACK:
hr = (initContext->browserObject->m_pWB)->GoBack();
break;
case WM_FORWARD:
hr = (initContext->browserObject->m_pWB)->GoForward();
break;
case WM_STOP:
hr = (initContext->browserObject->m_pWB)->Stop();
break;
case WM_RESIZE :
hr = MoveWindow(initContext->browserHost, initContext->x, initContext->y, initContext->w, initContext->h, TRUE);
break;
case WM_BIGTEST:
hr = ::MessageBox(initContext->browserHost, "command state changed", "youknow", MB_OK);
break;
}
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
}
initContext->canForward = initContext->browserObject->GetForwardState();
initContext->canBack = initContext->browserObject->GetBackState();
return 1;
@ -277,17 +267,16 @@ int processEventLoop(WebShellInitContext * initContext)
HRESULT InitIEStuff (WebShellInitContext * initContext)
{
HRESULT hr;
HRESULT hr;
HWND m_hWndClient;
RECT rect;
HWND localParent = initContext->parentHWnd;
HWND localChild = initContext->browserHost;
HWND localParent = initContext->parentHWnd;
HWND localChild = initContext->browserHost;
HRESULT hRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
ATLASSERT(SUCCEEDED(hRes));
HRESULT hRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
ATLASSERT(SUCCEEDED(hRes));
/*if (_WIN32_IE >= 0x0300)
INITCOMMONCONTROLSEX iccx;
@ -298,60 +287,55 @@ HRESULT InitIEStuff (WebShellInitContext * initContext)
ATLASSERT(bRet);
#else
*/
::InitCommonControls();
// ::InitCommonControls();
//#endif
GetClientRect(initContext->parentHWnd, &rect);
HINSTANCE newInst = GetModuleHandleA(NULL);
hRes = _Module.Init(NULL, newInst);
ATLASSERT(SUCCEEDED(hRes));
HINSTANCE newInst = GetModuleHandleA(NULL);
hRes = _Module.Init(NULL, newInst);
ATLASSERT(SUCCEEDED(hRes));
AtlAxWinInit();
m_hWndClient = initContext->browserObject->Create(
initContext->parentHWnd,
rect,
_T("about:blank"),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
WS_VSCROLL | WS_HSCROLL,
WS_EX_CLIENTEDGE,
ID_WEBBROWSER);
m_hWndClient = initContext->browserObject->Create(
initContext->parentHWnd,
rect,
_T("about:blank"),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
WS_VSCROLL | WS_HSCROLL,
WS_EX_CLIENTEDGE,
ID_WEBBROWSER);
hr = initContext->browserObject->QueryControl(&(initContext->browserObject->m_pWB));
hr = initContext->browserObject->QueryControl(&(initContext->browserObject->m_pWB));
if FAILED(hr)
{
ATLTRACE(_T("Couldn't retrieve webbrowser"));
return (-1);
}
if FAILED(hr)
{
ATLTRACE(_T("Couldn't retrieve webbrowser"));
return (-1);
}
if SUCCEEDED(hr)
{
ATLTRACE(_T("Browser succesfully retrieved"));
}
if SUCCEEDED(hr)
{
ATLTRACE(_T("Browser succesfully retrieved"));
}
(initContext->browserHost) = m_hWndClient;
if (!initContext->browserObject->spUnk) {
if (!initContext->browserObject->spUnk) {
hr = initContext->browserObject->QueryControl(&(initContext->browserObject->spUnk));
hr = initContext->browserObject->DispEventAdvise(initContext->browserObject->spUnk);
}
}
if FAILED(hr)
{
ATLTRACE(_T("Couldn't establish connection points"));
return -1;
}
if FAILED(hr)
{
ATLTRACE(_T("Couldn't establish connection points"));
return -1;
}
processEventLoop(initContext);
return 0;
return 0;
}

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- 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
@ -18,9 +18,10 @@
* Rights Reserved.
*
* Contributor(s): Glenn Barney <gbarney@uiuc.edu>
* Ron Capelli <capelli@us.ibm.com>
*/
#include "ie_globals.h"
#include "NavigationImpl.h"
@ -29,27 +30,24 @@
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeLoadURL
(JNIEnv *env, jobject obj, jint webShellPtr, jstring urlString)
{
jobject jobj = obj;
jobject jobj = obj;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeLoadURL");
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeLoadURL");
}
const wchar_t * urlStringChars = ::util_GetStringChars(env, urlString);
if (::util_ExceptionOccurred(env)) {
::util_ThrowExceptionToJava(env, "nativeLoadURL Exception: unable to extract Java string");
if (urlStringChars != NULL)
::util_ReleaseStringChars(env, urlString, urlStringChars);
return;
if (::util_ExceptionOccurred(env)) {
::util_ThrowExceptionToJava(env, "nativeLoadURL Exception: unable to extract Java string");
if (urlStringChars != NULL)
::util_ReleaseStringChars(env, urlString, urlStringChars);
return;
}
initContext->wcharURL = _wcsdup((const wchar_t *) urlStringChars);
initContext->wcharURL = _wcsdup((const wchar_t *) urlStringChars);
HRESULT hr = PostMessage(initContext->browserHost, WM_NAVIGATE, 0, 0);
::util_ReleaseStringChars(env, urlString, urlStringChars);
@ -58,31 +56,54 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeRefresh
(JNIEnv *env, jobject obj, jint webShellPtr, jlong loadFlags)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeRefresh");
return;
}
HRESULT hr = PostMessage(initContext->browserHost, WM_REFRESH,0, 0);
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeRefresh");
return;
}
HRESULT hr = PostMessage(initContext->browserHost, WM_REFRESH,0, 0);
return;
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeStop
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeStop");
return;
}
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeStop");
return;
}
HRESULT hr = PostMessage(initContext->browserHost, WM_STOP, 0, 0);
}
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeSetPrompt
(JNIEnv *env, jobject obj, jint webShellPtr, jobject userPrompt)
{
JNIEnv * pEnv = env;
jobject jobj = obj;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == nsnull) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeSetPrompt");
return;
}
if (userPrompt == nsnull) {
::util_ThrowExceptionToJava(env, "Exception: null properties passed to nativeSetPrompt");
return;
}
if (!initContext->initComplete) {
return;
}
// hr = PostMessage(initContext->browserHost, ?SETPROMPT?, 0, 0);
}

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- 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
@ -18,8 +18,9 @@
* Rights Reserved.
*
* Contributor(s): Glenn Barney <gbarney@uiuc.edu>
* Ron Capelli <capelli@us.ibm.com>
*/
#include "WindowControlImpl.h"
#include <windows.h>
#include <jni.h>
@ -28,52 +29,49 @@
#include "CMyDialog.h"
JNIEXPORT void JNICALL
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeSetBounds
(JNIEnv *env, jobject obj, jint webShellPtr, jint x, jint y, jint w, jint h)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null Ptr passed to nativeSetBounds");
return;
}
initContext->x = x;
initContext->y = y;
initContext->w = w;
initContext->h = h;
HRESULT hr = PostMessage(initContext->browserHost, WM_RESIZE, 0, 0);
}
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeCreateInitContext
(JNIEnv *env, jobject obj, jint windowPtr, jint x, jint y,
(JNIEnv *env, jobject obj, jint windowPtr, jint x, jint y,
jint width, jint height, jobject aBrowserControlImpl)
{
#ifdef XP_MAC
//MAC STUFF GOES HERE
#elif defined(XP_PC)
HWND parentHWnd = (HWND)windowPtr;
#elif defined(XP_UNIX)
//unix stuff here
#endif
if (parentHWnd == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null window handle passed to raptorWebShellCreate");
return (jint) 0;
}
// save vm reference, declared in ../src_share/jni_util.h
if (nsnull == gVm)
::util_GetJavaVM(env, &gVm);
WebShellInitContext* initContext = new WebShellInitContext;
initContext->initComplete = FALSE;
initContext->initFailCode = 0;
initContext->parentHWnd = parentHWnd;
initContext->wcharURL=NULL;
initContext->wcharURL=NULL;
initContext->env = env;
initContext->nativeEventThread = NULL;
@ -87,78 +85,77 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlI
return (jint) initContext;
}
JNIEXPORT void JNICALL
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeDestroyInitContext
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeDestroyInitContext");
return;
}
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
initContext->parentHWnd = NULL;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to nativeDestroyInitContext");
return;
}
initContext->env = NULL;
initContext->wcharURL = NULL;
initContext->parentHWnd = NULL;
if (NULL != initContext->nativeEventThread) {
::util_DeleteGlobalRef(env, initContext->nativeEventThread);
initContext->env = NULL;
initContext->wcharURL = NULL;
if (NULL != initContext->nativeEventThread) {
::util_DeleteGlobalRef(env, initContext->nativeEventThread);
initContext->nativeEventThread = NULL;
}
initContext->initComplete = FALSE;
initContext->initFailCode = 0;
initContext->x = -1;
initContext->y = -1;
initContext->w = -1;
initContext->h = -1;
initContext->h = -1;
delete initContext->browserObject;
initContext->browserObject = NULL;
delete initContext;
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeMoveWindowTo
(JNIEnv *env, jobject obj, jint webShellPtr, jint x, jint y)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null Ptr passed to nativeMoveWindowTo");
return;
}
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null Ptr passed to nativeMoveWindowTo");
return;
}
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeRemoveFocus
(JNIEnv *env, jobject obj, jint webShellPtr)
{
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeRepaint
(JNIEnv *env, jobject obj, jint webShellPtr, jboolean forceRepaint)
{
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeSetVisible
(JNIEnv *env, jobject obj, jint webShellPtr, jboolean newState)
{
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_WindowControlImpl_nativeSetFocus
(JNIEnv *env, jobject obj, jint webShellPtr)
{
}

Просмотреть файл

@ -1,5 +1,5 @@
/* -*- 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
@ -18,46 +18,16 @@
* Rights Reserved.
*
* Contributor(s): Glenn Barney <gbarney@uiuc.edu>
* Ron Capelli <capelli@us.ibm.com>
*/
#include "WrapperFactoryImpl.h"
#include "ie_util.h"
#include "ie_globals.h"
#include "prenv.h"
#ifdef XP_PC
// All this stuff is needed to initialize the history
#define APPSHELL_DLL "appshell.dll"
#define BROWSER_DLL "nsbrowser.dll"
#define EDITOR_DLL "ender.dll"
#else
#ifdef XP_MAC
#define APPSHELL_DLL "APPSHELL_DLL"
#define EDITOR_DLL "ENDER_DLL"
#else
// XP_UNIX || XP_BEOS
#define APPSHELL_DLL "libnsappshell"MOZ_DLL_SUFFIX
#define APPCORES_DLL "libappcores"MOZ_DLL_SUFFIX
#define EDITOR_DLL "libender"MOZ_DLL_SUFFIX
#endif // XP_MAC
#endif // XP_PC
//
// file data
//
//
const char *gImplementedInterfaces[] = {
"webclient.WindowControl",
@ -74,40 +44,38 @@ const char *gImplementedInterfaces[] = {
//
// Functions to hook into mozilla
//
// Functions to hook into Explorer
//
JNIEXPORT void JNICALL
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeAppInitialize
(JNIEnv *env, jobject obj, jstring verifiedBinDirAbsolutePath)
{
}
JNIEXPORT void JNICALL
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeTerminate
(JNIEnv *env, jobject obj)
{
}
JNIEXPORT jboolean JNICALL
JNIEXPORT jboolean JNICALL
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeDoesImplement
(JNIEnv *env, jobject obj, jstring interfaceName)
{
const char *iName = (const char *) ::util_GetStringUTFChars(env,
const char *iName = (const char *) ::util_GetStringUTFChars(env,
interfaceName);
jboolean result = JNI_FALSE;
int i = 0;
if (nsnull == iName) {
return result;
}
while (nsnull != gImplementedInterfaces[i]) {
if (0 == strcmp(gImplementedInterfaces[i++], iName)) {
result = JNI_TRUE;
@ -115,6 +83,6 @@ Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeDoesImplemen
}
}
::util_ReleaseStringUTFChars(env, interfaceName, iName);
return result;
}

Просмотреть файл

Просмотреть файл

@ -18,6 +18,7 @@
* Rights Reserved.
*
* Contributor(s): Glenn Barney <gbarney@uiuc.edu>
* Ron Capelli <capelli@us.ibm.com>
*/
@ -34,10 +35,10 @@
// pulls in ../src_share/jni_util_export.h
#include <Exdisp.h>
#include <atlbase.h> //for CComPtr
#include <AtlApp.h> // for CAppModule decl WTL
//#include <AtlApp.h> // for CAppModule decl WTL
extern CAppModule _Module;
//extern CAppModule _Module;
extern CComModule _Module;
#include <Atlwin.h> // for AtlWin
#include <Atlcom.h>
@ -48,7 +49,7 @@ extern CAppModule _Module;
#include <atlhost.h>
//#include <atlframe.h>//WTL
#include <atlctrls.h>//WTL
//#include <atlctrls.h>//WTL
//#include <atlctrlw.h>//WTL
//#include <atlmisc.h> //WTL
//#include <atlimpl.cpp>
@ -58,23 +59,22 @@ class CMyDialog;
extern const char *gSupportedListenerInterfaces[]; // defined in ie_util.cpp
struct WebShellInitContext {
HWND parentHWnd;
HWND browserHost;
JNIEnv * env;
jobject nativeEventThread;
const wchar_t * wcharURL;
int initComplete;
int initFailCode;
int x;
int y;
int w;
int h;
jboolean canForward;
jboolean canBack;
struct WebShellInitContext
{
HWND parentHWnd;
HWND browserHost;
JNIEnv * env;
jobject nativeEventThread;
const wchar_t * wcharURL;
int initComplete;
int initFailCode;
int x;
int y;
int w;
int h;
jboolean canForward;
jboolean canBack;
CMyDialog *browserObject;
};
#endif // ie_util_h

Просмотреть файл

@ -0,0 +1,13 @@
: Script to run webclient in development environment...
cd D:\Projects\mozilla\MOZILLA_1_3\mozilla\java
set CLASSPATH=D:\Projects\mozilla\MOZILLA_1_3\mozilla\dist\classes;%CLASSPATH%
set WCIEPATH=D:\Projects\mozilla\MOZILLA_1_3\mozilla\java\webclient\src_ie
set PATH=%WCIEPATH%;%PATH%
java -Djava.library.path=%WCIEPATH% -classpath %CLASSPATH% org.mozilla.webclient.test.EmbeddedMozillaImpl %WCIEPATH%

Просмотреть файл

@ -395,6 +395,9 @@ InputStreamShim::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32
NS_IMETHODIMP
InputStreamShim::IsNonBlocking(PRBool *_retval)
{
NS_NOTREACHED("IsNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
// NS_NOTREACHED("IsNonBlocking");
// return NS_ERROR_NOT_IMPLEMENTED;
*_retval = PR_FALSE;
return NS_OK;
}

Просмотреть файл

@ -27,7 +27,7 @@
* Louis-Philippe Gagnon <louisphilippe@macadamian.com>
* Brian Satterfield <bsatterf@atl.lmco.com>
* Anthony Sizer <sizera@yahoo.com>
* Ron Capelli <capelli@acm.org>
* Ron Capelli <capelli@us.ibm.com>
*/
/*
@ -159,9 +159,11 @@ wsLoadFromStreamEvent::handleEvent ()
// Kick off a LoadStream. This will cause
// InputStreamShim::Read() to be called,
printf ("debug: capelli: LoadStream - mContentType: %s mUriString: %s\n",
mContentType, mUriString.get());
rv = mInitContext->docShell->LoadStream(mShim, uri,
nsDependentCString(mContentType,
mShim->getContentLength()),
nsDependentCString(mContentType),
NS_LITERAL_CSTRING(""),
nsnull);
if (mProperties) {

Просмотреть файл

@ -18,6 +18,7 @@
* Rights Reserved.
*
* Contributor(s): Ashu Kulkarni
* Ron Capelli (capelli@us.ibm.com)
*/
@ -29,6 +30,8 @@
#include <jawt_md.h>
#include <jawt.h>
typedef jboolean (JNICALL *PJAWT_GETAWT)(JNIEnv*, JAWT*);
#include "Win32BrowserControlCanvas.h"
#include "ns_util.h" //for throwing Exceptions to Java
@ -45,21 +48,46 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32Bro
JAWT_DrawingSurfaceInfo* dsi;
JAWT_Win32DrawingSurfaceInfo* dsi_win;
HWND handle_win;
HMODULE _hAWT; // JAWT module handle
jint lock;
PJAWT_GETAWT pJAWT_GetAWT; // JAWT_GetAWT function pointer
//Get the AWT
_hAWT = LoadLibrary("jawt.dll");
if (!_hAWT) {
printf(" +++ No jawt.dll... Trying awt.dll +++ \n");
_hAWT = LoadLibrary("awt.dll"); // IBM Java 1.3.x packages JAWT_GetAWT in awt.dll
}
if (!_hAWT) {
printf(" +++ JAWT DLL Not Found +++ \n");
::util_ThrowExceptionToJava(env, "Exception: JAWT DLL Not Found");
return 0;
}
pJAWT_GetAWT = (PJAWT_GETAWT)GetProcAddress(_hAWT, "_JAWT_GetAWT@8");
printf ("Debug (RBC): pJAWT_GetAWT: %08x\n", pJAWT_GetAWT);
if (!pJAWT_GetAWT) {
printf(" +++ JAWT_GetAWT Entry Not Found +++ \n");
::util_ThrowExceptionToJava(env, "Exception: JAWT_GetAWT Entry Not Found");
FreeLibrary(_hAWT);
return 0;
}
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
if (pJAWT_GetAWT(env, &awt) == JNI_FALSE) {
printf(" +++ AWT Not Found +++ \n");
::util_ThrowExceptionToJava(env, "Exception: AWT Not Found");
FreeLibrary(_hAWT);
return 0;
}
//Get the Drawing Surface
ds = awt.GetDrawingSurface(env, canvas);
if (ds == NULL) {
printf(" +++ NULL Drawing Surface +++ \n");
::util_ThrowExceptionToJava(env, "Exception: Null Drawing Surface");
FreeLibrary(_hAWT);
return 0;
}
@ -69,6 +97,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32Bro
printf(" +++ Error Locking Surface +++ \n");
::util_ThrowExceptionToJava(env, "Exception: Error Locking Surface");
awt.FreeDrawingSurface(ds);
FreeLibrary(_hAWT);
return 0;
}
@ -79,9 +108,10 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32Bro
::util_ThrowExceptionToJava(env, "Exception: Error Getting Surface Info");
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
FreeLibrary(_hAWT);
return 0;
}
//Get the Platform specific Drawing Info
dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
@ -92,8 +122,8 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_win32_Win32Bro
ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
FreeLibrary(_hAWT);
//return the native peer handle
return (jint) handle_win;
}