This checkin is the next step for getting DocumentLoadListener to work.

I now have the new architecture for pumping events from mozilla back
into java.  I've added a sequence diagram to
<http://www.mozilla.org/projects/blackwood/webclient/design/20040306-webclient-2_0.zargo>
and updated the private API class diagram.

The next step will be to have the EmbedProgress::On* methods call back
to EventRegistration.nativeEventOccured.

M src_moz/EmbedProgress.cpp
M src_moz/EmbedProgress.h

- make this class maintain a reference to the java EventRegistration
  instance for this BrowserControl

M src_moz/NativeBrowserControl.cpp
M src_moz/NativeBrowserControl.h

- make this class maintain a reference to the java BrowserControl instance.

M src_moz/WindowControlImpl.cpp

- push the java BrowserControl to the NativeBrowserControl on Realize().

M src_moz/WrapperFactoryImpl.cpp
M src_moz/ns_globals.h

- expose gImplementedInterfaces in ns_globals.h


git-svn-id: svn://10.0.0.236/trunk@157781 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2004-06-11 15:55:48 +00:00
parent a57ea7b105
commit 51c33f1e5a
8 changed files with 87 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ NativeBrowserControl::NativeBrowserControl(void)
mNavigation = nsnull;
mSessionHistory = nsnull;
mWindow = nsnull;
mJavaBrowserControl = nsnull;
mChromeMask = 0;
mIsChrome = PR_FALSE;
mChromeLoaded = PR_FALSE;
@@ -54,6 +55,7 @@ NativeBrowserControl::~NativeBrowserControl()
mChromeMask = 0;
mIsChrome = PR_FALSE;
mChromeLoaded = PR_FALSE;
mJavaBrowserControl = nsnull;
}
nsresult
@@ -93,9 +95,12 @@ NativeBrowserControl::Init()
}
nsresult
NativeBrowserControl::Realize(void *parentWinPtr, PRBool *aAlreadyRealized,
NativeBrowserControl::Realize(jobject javaBrowserControl,
void *parentWinPtr, PRBool *aAlreadyRealized,
PRUint32 width, PRUint32 height)
{
mJavaBrowserControl = javaBrowserControl;
// Create our session history object and tell the navigation object
// to use it. We need to do this before we create the web browser
// window.
@@ -123,6 +128,18 @@ NativeBrowserControl::Realize(void *parentWinPtr, PRBool *aAlreadyRealized,
mWindow->AddWebBrowserListener(weakRef,
nsIWebProgressListener::GetIID());
// set the eventRegistration into the progress listener
jobject eventRegistration =
this->QueryInterfaceJava(EVENT_REGISTRATION_INDEX);
if (nsnull != eventRegistration) {
mProgress->SetEventRegistration(eventRegistration);
}
else {
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
::util_ThrowExceptionToJava(env, "Can't get EventRegistration from BrowserControl");
}
return NS_OK;
}
@@ -204,4 +221,27 @@ NativeBrowserControl::Destroy(void)
parentHWnd = nsnull;
}
jobject NativeBrowserControl::QueryInterfaceJava(WEBCLIENT_INTERFACES interface)
{
PR_ASSERT(nsnull != mJavaBrowserControl);
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
jobject result = nsnull;
jstring interfaceJStr = ::util_NewStringUTF(env,
gImplementedInterfaces[interface]);
jclass clazz = env->GetObjectClass(mJavaBrowserControl);
jmethodID mid = env->GetMethodID(clazz, "queryInterface",
"(Ljava/lang/String;)Ljava/lang/Object;");
if (nsnull != mid) {
result = env->CallObjectMethod(mJavaBrowserControl, mid,
interfaceJStr);
}
else {
::util_ThrowExceptionToJava(env, "Can't QueryInterface BrowserControl");
}
::util_DeleteStringUTF(env, interfaceJStr);
return result;
}