You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.
nsIURIContentListener
This interface is used by components which want to know about (and have a chance to handle) a particular content type. Typical usage scenarios will include running applications which register a
nsIURIContentListener
for each of its content windows with the URIdispatcher service.Gives the original content listener first crack at stopping a load before it happens.
Syntax:
boolean nsIURIContentListener::onStartURIOpen( in nsIURI aURI)Parameters:
Returns:
Notifies the content listener to hook up an
nsIStreamListener
capable of consuming the data stream.Syntax:
boolean nsIURIContentListener::doContent( in string aContentType, in boolean aIsContentPreferred, in nsIRequest aRequest, out nsIStreamListener aContentHandler)Parameters:
aContentHandler
: ThensIStreamListener
that will consume the data. This should be set tonsnull
if no consumer can handle the content type.
Returns:
TRUE
if the consumer wants to handle the load completely by itself. This causes the URI Loader do nothing else.
Indicates if this content handler "is preferred" for this content type. When given a URI to dispatch, if the URI is specified as 'preferred content' then the URI loader tries to find a preferred content handler for the content type. The thought is that many content listeners may be able to handle the same content type if they have to. i.e. the mail content window can handle text/html just like a browser window content listener. However, if the user clicks on a link with text/html content, then the browser window should handle that content and not the mail window where the user may have clicked the link. This is the difference between isPreferred and canHandleContent.
Syntax:
boolean nsIURIContentListener::isPreferred( in string aContentType,out string aDesiredContentType)Parameters:
aDesiredContentType
: The desired destination content type. This indicates thataContentType
must be converted toaDesiredContentType
before processing the data. This causes a stream converter to be inserted into thensIStreamListener
chain. This argument can bensnull
if the content should be consumed directly as aContentType.
Returns:
Indicates whether the content listener is capable of handling the content. This is called by the URI loader when given a URI to dispatch where the URI is not specified as 'preferred content'
Note:
canHandleContent
is best understood as a method implemented by the docshell as the implementation generic to all doc shells. TheisPreferred
decision is a decision made by a top level application content listener that sits at the top of the docshell hiearchy.Syntax:
boolean nsIURIContentListener::canHandleContent( in string aContentType in boolean aIsContentPreferred, out string aDesiredContentType)Parameters:
aDesiredContentType
: The desired destination content type. This indicates thataContentType
must be converted toaDesiredContentType
before processing the data. This causes a stream converter to be inserted into thensIStreamListener
chain. This argument can bensnull
if the content should be consumed directly asaContentType
.
Returns:
Gets and sets the load context associated with a particular content listener. The URI Loader stores and accesses this value as needed.
Gets and sets the parent content listener if this particular listener is part of a chain of content listeners (i.e.a docshell).
Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |