Hi Boris,
thx for your answer.
> Redefined that on which nsIURIContentListener implementation?
I have a (somewhat monolithic) EmbeddedBrowser class doing all the
stuff, so it's basically a listener of itself..
in EmbeddedBrowser.h:
--------------------------
class EmbeddedBrowser
: public EBObject // my stuff
, public HasTouchTime // my stuff
, public nsIInterfaceRequestor
, public nsIWebProgressListener
, public nsIWebBrowserChrome
, public nsIEmbeddingSiteWindow
, public nsIURIContentListener
, public nsSupportsWeakReference
{
public:
virtual ~EmbeddedBrowser();
NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIURICONTENTLISTENER
[snip]
nsCOMPtr<nsIWebBrowser> mWebBrowser;
[snip]
}
--------------------------
and in EmbeddedBrowser.cpp:
--------------------------
NS_IMPL_ADDREF( EmbeddedBrowser )
NS_IMPL_RELEASE( EmbeddedBrowser )
NS_INTERFACE_MAP_BEGIN( EmbeddedBrowser )
NS_INTERFACE_MAP_ENTRY( nsIInterfaceRequestor )
NS_INTERFACE_MAP_ENTRY( nsIWebProgressListener )
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS( nsISupports, nsIWebBrowserChrome )
NS_INTERFACE_MAP_ENTRY( nsIWebBrowserChrome )
NS_INTERFACE_MAP_ENTRY( nsIEmbeddingSiteWindow )
NS_INTERFACE_MAP_ENTRY( nsIURIContentListener )
NS_INTERFACE_MAP_ENTRY( nsISupportsWeakReference )
NS_INTERFACE_MAP_END
[snip]
EmbeddedBrowser::Init([snip])
{
[snip]
if ( NS_FAILED( mWebBrowser->SetParentURIContentListener( this )))
{
LOG_ERRORSTREAM(EBRLogger, "Cannot URI Content Listener" );
return PR_FALSE;
}
[snip]
}
[snip]
NS_IMETHODIMP EmbeddedBrowser::IsPreferred(const char *ct, char **dct,
PRBool *_ret)
{
// here stuff to check content type, detect PDFs,
// reissuing a mangled LoadURI and setting *_retval = false...
// this one does not get called on <A target="_blank" ...> nodes.
}
----------------------------
As always, your questions shed lights. You mean that I should derive
my EmbeddedBrowser from an IMPLEMENTATION of nsIURIContentListener
lying somewhere in Mozilla code, and not from the bare interface,
because under some circumstances the bare redefined interface methods
will not get called? This is confusing... I gave for granted that the
underlying "framework" would work anyway... but, now that you say
that, I realize that I have breakpoints somewhere else (i.e.
CanHandleContent) and those are NEVER hit too... but OnStartURIOpen
works like a charm!
I am confused now.
> It sure should be called, if I read the code right. Depending on your
> answer to the above question, of course.
did I answer? :)
> > Any clue about how to implement the thing in a more robust way?
>
> Implement an nsIContentHandler or generic nsIURIContentListener
> registered for the PDF type? That would catch all PDF loads too, not
> just ones triggered via links...
checking this way now.
thanks!
Aaron
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding