no bug - just reworking nsIURIContentListener to be more easily implemented in JS - does not affect any C++ interface signatures

sr=mscott
This commit is contained in:
alecf%netscape.com 2001-03-21 19:21:34 +00:00
Родитель 6a3a4a8997
Коммит 01b6ed44fd
1 изменённых файлов: 51 добавлений и 49 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* *
* The contents of this file are subject to the Netscape Public * The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file * License Version 1.1 (the "License"); you may not use this file
@ -44,10 +44,9 @@ interface nsIURIContentListener : nsISupports
aURI --> the uri we are going to try and open. aURI --> the uri we are going to try and open.
aWindowTarget --> the window target passed to the uriloader to open. aWindowTarget --> the window target passed to the uriloader to open.
aAbortOpen --> specifies that the open should be aborted. return value --> specifies if the open should be aborted.
*/ */
void onStartURIOpen(in nsIURI aURI, in string aWindowTarget, boolean onStartURIOpen(in nsIURI aURI, in string aWindowTarget);
out boolean aAbortOpen);
/* Give the content listener first crack at forcing us to use /* Give the content listener first crack at forcing us to use
a specific content handler. Content listener's do not need to a specific content handler. Content listener's do not need to
@ -59,7 +58,7 @@ interface nsIURIContentListener : nsISupports
to use. You can pass back null if you want the uri loader to look to use. You can pass back null if you want the uri loader to look
up an appropriate protocol handler up an appropriate protocol handler
*/ */
void getProtocolHandler(in nsIURI aURI, out nsIProtocolHandler aProtocolHandler); nsIProtocolHandler getProtocolHandler(in nsIURI aURI);
/* doContent --> When the content listener is expected to process the /* doContent --> When the content listener is expected to process the
content, the uri loader calls doContent. doContent needs to return a content, the uri loader calls doContent. doContent needs to return a
@ -71,61 +70,64 @@ interface nsIURIContentListener : nsISupports
aStreamListener --> the content viewer the content should be displayed in aStreamListener --> the content viewer the content should be displayed in
You should return null for this out parameter if you do You should return null for this out parameter if you do
not want to handle this content type. not want to handle this content type.
aAbortProcess --> If you want to handle the content yourself and you don't return value --> If you want to handle the content yourself and you don't
want the dispatcher to do anything else, return TRUE for want the dispatcher to do anything else, return
this parameter. TRUE, else return false.
*/ */
void doContent(in string aContentType, boolean doContent(in string aContentType,
in nsURILoadCommand aCommand, in nsURILoadCommand aCommand,
in string aWindowTarget, in string aWindowTarget,
in nsIRequest request, in nsIRequest request,
out nsIStreamListener aContentHandler, out nsIStreamListener aContentHandler);
out boolean aAbortProcess);
/* When given a uri to dispatch, if the load type is a user click, /* When given a uri to dispatch, if the load type is a user click,
then the uri loader tries to find a preferred content handler for then the uri loader tries to find a preferred content handler
this content type. The thought is that many content listeners may for this content type. The thought is that many content
be able to handle the same content type if they have to. i.e. the mail listeners may be able to handle the same content type if they
content window can handle text/html just like a browser window content have to. i.e. the mail content window can handle text/html just
listener. However, if the user clicks on a link with text/html content, like a browser window content listener. However, if the user
we'd like the browser window to handle that content and not the mail window clicks on a link with text/html content, we'd like the browser
where the user may have clicked the link. That's why we have isPreferred. window to handle that content and not the mail window where the
user may have clicked the link. That's why we have isPreferred.
aContentType --> the content type to handle
aCommand --> verb for the action aContentType --> the content type to handle
aWindowTarget --> name of the target window (if any) aCommand --> verb for the action
aWindowTarget --> name of the target window (if any)
aDesiredContentType --> yes, we can accept aContentType but we would aDesiredContentType --> yes, we can accept aContentType but we would
like it converted to aDesiredContentType. This argument can be null if like it converted to aDesiredContentType. This argument can
you want the content directly as aContentType be null if you want the content directly as aContentType
boolean --> return true if you are a preferred content handler for aContentType boolean --> return true if you are a preferred content handler
and false otherwise. for aContentType and false otherwise.
*/ */
boolean isPreferred(in string aContentType, boolean isPreferred(in string aContentType,
in nsURILoadCommand aCommand, in nsURILoadCommand aCommand,
in string aWindowTarget, in string aWindowTarget,
out string aDesiredContentType); out string aDesiredContentType);
/* When given a uri to dispatch, if the load type is anything but user click, /* When given a uri to dispatch, if the load type is anything but
the uri loader will call canHandleContent to see if the content listener user click, the uri loader will call canHandleContent to see if
can handle the content. The arguments are the same as isPreferred. the content listener can handle the content. The arguments are
the same as isPreferred.
Note: I really envision canHandleContent as a method implemented by the docshell Note: I really envision canHandleContent as a method implemented
as the implementation is generic to all doc shells. The IsPreferred decision by the docshell as the implementation is generic to all doc
is a decision made by a top level application content listener that sits at the shells. The IsPreferred decision is a decision made by a top level
top of the docshell hiearchy. application content listener that sits at the top of the docshell
hiearchy.
*/ */
boolean canHandleContent(in string aContentType, boolean canHandleContent(in string aContentType,
in nsURILoadCommand aCommand, in nsURILoadCommand aCommand,
in string aWindowTarget, in string aWindowTarget,
out string aDesiredContentType); out string aDesiredContentType);
/* Get/Set loadCookie are methods the uri loader calls on the nsIURIContentListener /* Get/Set loadCookie are methods the uri loader calls on the
in order to store / associate a load context with this particular content listener... * nsIURIContentListener in order to store / associate a load context
* with this particular content listener...
*/ */
attribute nsISupports loadCookie; attribute nsISupports loadCookie;
/* if you are part of a chain of content listeners (i.e. if you are a docshell!, /* if you are part of a chain of content listeners (i.e. if you are
return your parent content listener * a docshell!) return your parent content listener
*/ */
attribute nsIURIContentListener parentContentListener; attribute nsIURIContentListener parentContentListener;
}; };