This commit is contained in:
edburns%acm.org 2000-08-10 01:33:35 +00:00
Родитель 4f4b815479
Коммит 4e0e4a0292
14 изменённых файлов: 1401 добавлений и 4 удалений

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

@ -37,13 +37,25 @@ DEPTH = ..\..
DIRS = classes_spec \
src_share \
src_moz \
$(NULL)
!if defined(BAL_INTERFACE)
DIRS = classes_spec \
src_share \
# This macro makes it so if the environment var WC_IE is
# defined, then webclient will be built to use
# IE. Otherwise webclient will be built to use
# mozilla.
!if defined(WC_IE)
DIRS = $(DIRS) \
src_ie \
$(NULL)
!else
DIRS = $(DIRS) \
src_moz \
$(NULL)
!endif
!if defined(BAL_INTERFACE)
DIRS = $(DIRS) \
bal_test \
$(NULL)
!endif

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

@ -0,0 +1,48 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "BookmarksImpl.h"
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_nativeAddBookmark
(JNIEnv *, jobject, jint, jobject)
{
}
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_nativeGetBookmarks
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jint result = 0;
return result;
}
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_wrapper_1native_BookmarksImpl_nativeNewRDFNode
(JNIEnv *env, jobject obj, jstring urlString, jboolean isFolder)
{
jint result = 0;
return result;
}

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

@ -0,0 +1,122 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
/*
* CurrentPageImpl.cpp
*/
#include "CurrentPageImpl.h"
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeCopyCurrentSelectionToSystemClipboard
(JNIEnv *env, jobject obj, jint webShellPtr)
{
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeFindInPage
* Signature: (Ljava/lang/String;ZZ)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeFindInPage
(JNIEnv *env, jobject obj, jint webShellPtr, jstring searchString, jboolean forward, jboolean matchCase)
{
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeFindNextInPage
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeFindNextInPage
(JNIEnv *env, jobject obj, jint webShellPtr, jboolean forward)
{
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeGetCurrentURL
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeGetCurrentURL
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jstring urlString = 0;
return urlString;
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeGetSource
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeGetSource
(JNIEnv * env, jobject jobj)
{
jstring result = 0;
return result;
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeGetSourceBytes
* Signature: ()[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeGetSourceBytes
(JNIEnv * env, jobject jobj, jint webShellPtr, jboolean mode)
{
jbyteArray result = 0;
return result;
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeResetFind
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeResetFind
(JNIEnv * env, jobject obj, jint webShellPtr)
{
}
/*
* Class: org_mozilla_webclient_wrapper_0005fnative_CurrentPageImpl
* Method: nativeSelectAll
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_CurrentPageImpl_nativeSelectAll
(JNIEnv * env, jobject obj, jint webShellPtr)
{
}

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

@ -0,0 +1,162 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "HistoryImpl.h"
#include "ie_util.h"
#include "ie_globals.h"
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeBack
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellBack");
return;
}
HRESULT hr = PostMessage(initContext->browserHost, WM_BACK, 0, 0);
}
JNIEXPORT jboolean
JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeCanBack
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to CanBack");
return JNI_FALSE;
}
jboolean result = JNI_TRUE;
return result;
}
JNIEXPORT jobjectArray JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetBackList
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jobjectArray result = 0;
return result;
}
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeClearHistory
(JNIEnv *env, jobject obj, jint webShellPtr)
{
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeForward
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to raptorWebShellBack");
}
HRESULT hr = PostMessage(initContext->browserHost, WM_FORWARD, 0, 0);
}
JNIEXPORT jboolean JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeCanForward
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::util_ThrowExceptionToJava(env, "Exception: null webShellPtr passed to CanForward");
return JNI_FALSE;
}
jboolean result = JNI_TRUE;
return result;
}
JNIEXPORT jobjectArray JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetForwardList
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jobjectArray result = 0;
return result;
}
JNIEXPORT jobjectArray JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetHistory
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jobjectArray result = 0;
return result;
}
JNIEXPORT jobject JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetHistoryEntry
(JNIEnv *env, jobject obj, jint webShellPtr, jint historyIndex)
{
jobject result = 0;
return result;
}
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetCurrentHistoryIndex
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jint result = -1;
return result;
}
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeSetCurrentHistoryIndex
(JNIEnv *env, jobject obj, jint webShellPtr, jint historyIndex)
{
}
JNIEXPORT jint JNICALL
Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetHistoryLength
(JNIEnv *env, jobject obj, jint webShellPtr)
{
jint result = -1;
return result;
}
JNIEXPORT jstring JNICALL Java_org_mozilla_webclient_wrapper_1native_HistoryImpl_nativeGetURLForIndex
(JNIEnv *env, jobject obj, jint webShellPtr, jint historyIndex)
{
jstring urlString = 0;
return urlString;
}

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

@ -0,0 +1,47 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "ISupportsPeer.h"
//
// JNI methods
//
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_ISupportsPeer_nativeAddRef
(JNIEnv *env, jobject obj, jint nativeISupportsImpl)
{
}
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_ISupportsPeer_nativeRelease
(JNIEnv *env, jobject obj, jint nativeISupportsImpl)
{
}
//
// Local functions
//

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

@ -0,0 +1,86 @@
#!nmake
#
# 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):
DEPTH=..\..\..
IGNORE_MANIFEST=1
MAKE_OBJ_TYPE = DLL
DLLNAME = webclient
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MODULE=webclient
OBJS = \
.\$(OBJDIR)\BookmarksImpl.obj \
.\$(OBJDIR)\CurrentPageImpl.obj \
.\$(OBJDIR)\HistoryImpl.obj \
.\$(OBJDIR)\ISupportsPeer.obj \
.\$(OBJDIR)\NativeEventThread.obj \
.\$(OBJDIR)\NavigationImpl.obj \
.\$(OBJDIR)\WindowControlImpl.obj \
.\$(OBJDIR)\WrapperFactoryImpl.obj \
.\$(OBJDIR)\ie_util_export.obj \
.\$(OBJDIR)\ie_util.obj \
$(NULL)
LCFLAGS = \
-DDEBUG_RAPTOR_CANVAS \
$(NULL)
LLIBS = \
$(DIST)\lib\wc_share.lib \
$(NULL)
WIN_LIBS = \
version.lib
include <$(DEPTH)\config\rules.mak>
INCS = \
-I$(JDKHOME)\include \
-I$(JDKHOME)\include\win32 \
-I..\src_share \
$(INCS) \
$(NULL)
INCS=$(INCS) \
-I$(WTLHOME)\include \
$(NULL)
!CMDSWITCHES -S
buildRunems:
!ifdef BAL_INTERFACE
!else
@echo +++ Creating runem.bat. Use this to run the test browser.
rm -f runem.bat
@echo $(PERL) ..\src_share\runem.pl $(DIST)\bin org.mozilla.webclient.test.EmbeddedMozilla $(DEPTH) %1% >> runem.bat
!endif
install:: $(DLL) buildRunems
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber_all:: clobber
clobber::
rm -f runem.bat
rm -f $(DIST)\bin\$(DLLNAME).dll

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

@ -0,0 +1,379 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#define IDD_MYDIALOG 128
#define _WIN32_WINNT 0x0400
#define _WIN32_IE 0x0400
#include "NativeEventThread.h"
#include "ie_globals.h"
#include "ie_util.h"
#include <atlbase.h> //for CComPtr
#include <AtlApp.h> // for CAppModule decl
CAppModule _Module;
#include <Atlwin.h> // for AtlWin
#include <Atlcom.h>
#include <Exdisp.h> //for IWebBrowser2
#include <exdispid.h>
#include <atlhost.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atlctrlw.h>
#include <atlmisc.h>
#include <atlimpl.cpp>
#include <objbase.h>
#ifdef XP_PC
#include <windows.h>
#endif
#include <stdio.h>
#include "prlog.h" // for PR_ASSERT
#ifdef XP_UNIX
#include <unistd.h>
#include "gdksuperwin.h"
#include "gtkmozarea.h"
#endif
class CMyDialog:
public CAxWindow,
public IDispEventImpl<1, CMyDialog, &DIID_DWebBrowserEvents2,&LIBID_SHDocVw, 1, 0>
{
public:
//ComPtr<IUnknown> spUnk;
CComPtr<IWebBrowser2> 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()
};
//
// Local functions
//
//initializes IE stuff
HRESULT InitIEStuff (WebShellInitContext * arg);
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 * );
char * errorMessages[] = {
"No Error",
"Could not obtain the event queue service.",
"Unable to create the WebShell instance.",
"Unable to initialize the WebShell instance.",
"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
//
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;
}
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,
"NULL webShellPtr passed to nativeProcessEvents.");
return;
}
processEventLoop(initContext);
}
/**
* <P> This method takes the typedListener, which is a
* WebclientEventListener java subclass, figures out what type of
* subclass it is, using the gSupportedListenerInterfaces array, and
* calls the appropriate add*Listener local function. </P>
*<P> PENDING(): we could do away with the switch statement using
* function pointers, or some other mechanism. </P>
* <P>the NewGlobalRef call is very important, since the argument
* typedListener is used to call back into java, at another time, as a
* result of the a mozilla event being fired.</P>
* PENDING(): implement nativeRemoveListener, which must call
* RemoveGlobalRef.
* See the comments for EventRegistration.h:addDocumentLoadListener
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeAddListener
(JNIEnv *env, jobject obj, jint webShellPtr, jobject typedListener)
{
printf("debug: glenn: nativeAddListener\n");
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThread_nativeCleanUp
(JNIEnv *env, jobject obj, jint webShellPtr)
{
WebShellInitContext * initContext = (WebShellInitContext *) webShellPtr;
//AtlAdviseSinkMap(&browserHome, false)
//_Module.RemoveMessageLoop();
_Module.Term();
::CoUninitialize();
}
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();
break;
case WM_NAVIGATE:
hr = (initContext->m_pWB)->Navigate(CComBSTR(initContext->wcharURL), NULL, NULL, NULL, NULL);
free((void *) initContext->wcharURL);
initContext->wcharURL = nsnull;
break;
case WM_BACK:
hr = (initContext->m_pWB)->GoBack();
break;
case WM_FORWARD:
hr = (initContext->m_pWB)->GoForward();
break;
case WM_STOP:
hr = (initContext->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);
}
}
return 1;
}
HRESULT InitIEStuff (WebShellInitContext * initContext)
{
HRESULT hr;
HWND m_hWndClient;
RECT rect;
HWND localParent = initContext->parentHWnd;
HWND localChild = initContext->browserHost;
HRESULT hRes = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
ATLASSERT(SUCCEEDED(hRes));
/*if (_WIN32_IE >= 0x0300)
INITCOMMONCONTROLSEX iccx;
iccx.dwSize = sizeof(iccx);
iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
BOOL bRet = ::InitCommonControlsEx(&iccx);
bRet;
ATLASSERT(bRet);
#else
*/
::InitCommonControls();
//#endif
GetClientRect(initContext->parentHWnd, &rect);
HINSTANCE newInst = GetModuleHandleA(NULL);
hRes = _Module.Init(NULL, newInst);
ATLASSERT(SUCCEEDED(hRes));
CMyDialog browserHome;
AtlAxWinInit();
m_hWndClient = browserHome.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 = browserHome.QueryControl(&browserHome.m_pWB);
initContext->m_pWB = browserHome.m_pWB;
(initContext->browserHost) = m_hWndClient;
if FAILED(hr)
{
ATLTRACE(_T("Couldn't retrieve webbrowser"));
return (-1);
}
if SUCCEEDED(hr)
{
ATLTRACE(_T("Browser succesfully retrieved"));
}
// CComPtr<IUnknown> spUnk; //Unk Ptr will be used to sink the map
// hr = browserHome.QueryControl(&spUnk);
//hr = browserHome.DispEventAdvise(spUnk);
if FAILED(hr)
{
ATLTRACE(_T("Couldn't establish connection points"));
return -1;
}
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)
{
}

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

@ -0,0 +1,88 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "ie_globals.h"
#include "NavigationImpl.h"
#include "ie_util.h"
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeLoadURL
(JNIEnv *env, jobject obj, jint webShellPtr, jstring urlString)
{
jobject jobj = obj;
WebShellInitContext* initContext = (WebShellInitContext *) webShellPtr;
if (initContext == NULL) {
::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;
}
initContext->wcharURL = _wcsdup((const wchar_t *) urlStringChars);
HRESULT hr = PostMessage(initContext->browserHost, WM_NAVIGATE, 0, 0);
::util_ReleaseStringChars(env, urlString, urlStringChars);
}
JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NavigationImpl_nativeRefresh
(JNIEnv *env, jobject obj, jint webShellPtr, jlong loadFlags)
{
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);
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;
}
HRESULT hr = PostMessage(initContext->browserHost, WM_STOP, 0, 0);
}

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

@ -0,0 +1,159 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "WindowControlImpl.h"
#include <windows.h>
#include <jni.h>
#include "ie_util.h"
#include "ie_globals.h"
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,
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;
}
WebShellInitContext* initContext = new WebShellInitContext;
initContext->m_pWB = NULL;
initContext->initComplete = FALSE;
initContext->initFailCode = 0;
initContext->parentHWnd = parentHWnd;
initContext->wcharURL=NULL;
initContext->env = env;
initContext->nativeEventThread = NULL;
initContext->x = x;
initContext->y = y;
initContext->w = width;
initContext->h = height;
return (jint) initContext;
}
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;
}
initContext->parentHWnd = NULL;
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;
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;
}
}
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)
{
}

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

@ -0,0 +1,119 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#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",
"webclient.Navigation",
"webclient.CurrentPage",
"webclient.History",
0
};
//
// global data
//
//
// Functions to hook into mozilla
//
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeAppInitialize
(JNIEnv *env, jobject obj, jstring verifiedBinDirAbsolutePath)
{
}
JNIEXPORT void JNICALL
Java_org_mozilla_webclient_wrapper_1native_WrapperFactoryImpl_nativeTerminate
(JNIEnv *env, jobject obj)
{
}
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,
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;
break;
}
}
::util_ReleaseStringUTFChars(env, interfaceName, iName);
return result;
}

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

@ -0,0 +1,39 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#ifndef ie_globals_h
#define ie_globals_h
#define ID_WEBBROWSER 1
#define WM_REFRESH WM_USER + 1
#define WM_NAVIGATE WM_USER + 2
#define WM_BACK WM_USER + 3
#define WM_FORWARD WM_USER + 4
#define WM_STOP WM_USER + 5
#define WM_RESIZE WM_USER + 6
#define WM_BIGTEST WM_USER +7
#endif //ie_globals.h

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

@ -0,0 +1,39 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "ie_util.h"
//
// Implementations for functions defined in ../src_share/jni_util.h, but not
// implemented there.
//
void util_LogMessage(int level, const char *fmt)
{
printf(fmt);
}
void util_Assert(void *test)
{
ATLASSERT(test);
}

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

@ -0,0 +1,58 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
/**
* Util methods
*/
#ifndef ie_util_h
#define ie_util_h
#include "jni_util.h" // located in ../src_share,
// pulls in ../src_share/jni_util_export.h
#include <atlbase.h>
#include <Exdisp.h>
struct WebShellInitContext {
HWND parentHWnd;
HWND browserHost;
CComPtr<IWebBrowser2> m_pWB;
JNIEnv * env;
jobject nativeEventThread;
const wchar_t * wcharURL;
int initComplete;
int initFailCode;
int x;
int y;
int w;
int h;
bool canForward;
bool canBack;
};
#endif // ie_util_h

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

@ -0,0 +1,39 @@
/* -*- 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 <gbarney@uiuc.edu>
*/
#include "jni_util_export.h"
//
// Implementations for functions defined in ../src_share/jni_util.h, but not
// implemented there.
//
JNIEXPORT jint JNICALL util_StoreClassMapping(const char* jniClassName,
jclass yourClassType)
{
return 0;
}
JNIEXPORT jclass JNICALL util_GetClassMapping(const char* jniClassName)
{
return NULL;
}