This checkin is the first step to making DocumentLoadListener work
again. It provides the native class that implements nsIWebProgressListener, which I've copied form gtk_moz_embed, so it's gotta be good. The next step will be to hook this up to the java side. A src_moz/EmbedProgress.h A src_moz/EmbedProgress.cpp - mostly copied from GTKMOZEMBED M classes_spec/org/mozilla/webclient/impl/wrapper_native/NativeEventThread.java - remove javadoc reference to non-existing method M src_moz/EmbedWindow.cpp M src_moz/EmbedWindow.h - expose AddWebBrowserListener method. M src_moz/InputStreamShim.cpp - make FileInputStream testcase run M src_moz/Makefile.in M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add EmbedProgress M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java - Make this test run git-svn-id: svn://10.0.0.236/trunk@157716 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "nsEmbedAPI.h" // for NS_HandleEmbeddingEvent
|
||||
|
||||
#include "EmbedWindow.h"
|
||||
#include "EmbedProgress.h"
|
||||
#include "NativeBrowserControl.h"
|
||||
#include "ns_util.h"
|
||||
|
||||
@@ -66,6 +67,15 @@ NativeBrowserControl::Init()
|
||||
mWindowGuard = NS_STATIC_CAST(nsIWebBrowserChrome *, mWindow);
|
||||
mWindow->Init(this);
|
||||
|
||||
// Create our progress listener object, make an owning reference,
|
||||
// and initialize it. It is assumed that this progress listener
|
||||
// will be destroyed when we go out of scope.
|
||||
mProgress = new EmbedProgress();
|
||||
mProgressGuard = NS_STATIC_CAST(nsIWebProgressListener *,
|
||||
mProgress);
|
||||
mProgress->Init(this);
|
||||
|
||||
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser;
|
||||
mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
|
||||
|
||||
@@ -104,7 +114,15 @@ NativeBrowserControl::Realize(void *parentWinPtr, PRBool *aAlreadyRealized,
|
||||
|
||||
// create the window
|
||||
mWindow->CreateWindow_(width, height);
|
||||
|
||||
|
||||
// bind the progress listener to the browser object
|
||||
nsCOMPtr<nsISupportsWeakReference> supportsWeak;
|
||||
supportsWeak = do_QueryInterface(mProgressGuard);
|
||||
nsCOMPtr<nsIWeakReference> weakRef;
|
||||
supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
|
||||
mWindow->AddWebBrowserListener(weakRef,
|
||||
nsIWebProgressListener::GetIID());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -168,6 +186,21 @@ NativeBrowserControl::Destroy(void)
|
||||
|
||||
// release navigation
|
||||
mNavigation = nsnull;
|
||||
|
||||
// Release our progress listener
|
||||
nsCOMPtr<nsISupportsWeakReference> supportsWeak;
|
||||
supportsWeak = do_QueryInterface(mProgressGuard);
|
||||
nsCOMPtr<nsIWeakReference> weakRef;
|
||||
supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
|
||||
webBrowser->RemoveWebBrowserListener(weakRef,
|
||||
nsIWebProgressListener::GetIID());
|
||||
weakRef = nsnull;
|
||||
supportsWeak = nsnull;
|
||||
|
||||
// Now that we have removed the listener, release our progress
|
||||
// object
|
||||
mProgressGuard = nsnull;
|
||||
mProgress = nsnull;
|
||||
|
||||
parentHWnd = nsnull;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user