Thanks for your help, Boris.

On Fri, 4 Nov 2005, Boris Zbarsky wrote:
For the embedding case, I believe http://www.mozilla.org/projects/embedding/PublicAPIs.html talks about nsIWebProgress and how to get one some.

I don't really see it.. something about docloader service, I think.

It seems I might use nsIWebBrowser->AddWebBrowserListener,
where what it says is nsIWeakReference is really my
nsIWebProgressListener.

Yes, this would also work.

I guess I've become lost again. At first I thought this
looked right. Then when I sat down to do it (I just play
with it in my spare time), implemented the listener,
and I noticed how in gtkmozembed (embedding/browser/gtk/src/)
there's a class EmbedPrivate. This seems to be the "browser".
Inside this class, it uses AddWebBrowserListener. Something
like this:

  mProgress = new EmbedProgress();
  mProgressGuard = NS_STATIC_CAST(nsIWebProgressListener *,
                                       mProgress);
  // then later ...

  // bind the progress listener to the browser object
  nsCOMPtr<nsISupportsWeakReference> supportsWeak;
  supportsWeak = do_QueryInterface(mProgressGuard);
  nsCOMPtr<nsIWeakReference> weakRef;
  supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
  webBrowser->AddWebBrowserListener(weakRef,
                                    nsIWebProgressListener::GetIID());

Okay, so it keeps this reference around (mProgressGuard) so that
the thing being weakly referenced doesn't go out of scope or whatever.
But then I'm not getting how what I'm doing is supposed to work with
gtkmozembed. I'm going to have to create another layer around
gtkmozembed, I guess. Hm, maybe that's normal, hence the "embed" part. :)
It's just confusing because I'm really writing Perl wrappers
not embedding something, so there's like an extra layer of
indirection. I just want to control Mozilla and don't even care
about gtk. Ideally I'd have an equivalent of gtkmozembed
without the gtk part, but my impression is that's impossible.
Maybe somehow if you implemented enough classes though in
a custom browser, you could fool Mozilla into thinking there
was a window there when there wasn't.
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to