2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 20:52:41 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-10-30 01:46:18 +04:00
|
|
|
*
|
2004-04-17 20:52:41 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-10-30 01:46:18 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-10-30 01:46:18 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 20:52:41 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 20:52:41 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 20:52:41 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 20:52:41 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-10-30 01:46:18 +04:00
|
|
|
|
2004-04-17 01:06:07 +04:00
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIRequest;
|
|
|
|
interface nsIStreamListener;
|
|
|
|
interface nsIURI;
|
|
|
|
|
2001-03-24 03:22:18 +03:00
|
|
|
/**
|
2001-11-22 02:17:41 +03:00
|
|
|
* nsIURIContentListener is an interface used by components which
|
|
|
|
* want to know (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 uri
|
|
|
|
* dispatcher service.
|
|
|
|
*/
|
1999-10-30 01:46:18 +04:00
|
|
|
[scriptable, uuid(94928AB3-8B63-11d3-989D-001083010E9B)]
|
|
|
|
interface nsIURIContentListener : nsISupports
|
|
|
|
{
|
2001-11-22 02:17:41 +03:00
|
|
|
/**
|
|
|
|
* Gives the original content listener first crack at stopping a load before
|
|
|
|
* it happens.
|
|
|
|
*
|
|
|
|
* @param aURI URI that is being opened.
|
|
|
|
*
|
2004-09-09 19:30:09 +04:00
|
|
|
* @return <code>false</code> if the load can continue;
|
|
|
|
* <code>true</code> if the open should be aborted.
|
2000-03-24 03:23:40 +03:00
|
|
|
*/
|
2001-05-14 06:16:27 +04:00
|
|
|
boolean onStartURIOpen(in nsIURI aURI);
|
2000-03-24 03:23:40 +03:00
|
|
|
|
2001-11-22 02:17:41 +03:00
|
|
|
/**
|
|
|
|
* Notifies the content listener to hook up an nsIStreamListener capable of
|
|
|
|
* consuming the data stream.
|
|
|
|
*
|
|
|
|
* @param aContentType Content type of the data.
|
|
|
|
* @param aIsContentPreferred Indicates whether the content should be
|
|
|
|
* preferred by this listener.
|
|
|
|
* @param aRequest Request that is providing the data.
|
|
|
|
* @param aContentHandler nsIStreamListener that will consume the data.
|
|
|
|
* This should be set to <code>nsnull</code> if
|
2004-07-15 03:15:19 +04:00
|
|
|
* this content listener can't handle the content
|
|
|
|
* type.
|
2001-11-22 02:17:41 +03:00
|
|
|
*
|
|
|
|
* @return <code>true</code> if the consumer wants to
|
|
|
|
* handle the load completely by itself. This
|
|
|
|
* causes the URI Loader do nothing else...
|
|
|
|
* <code>false</code> if the URI Loader should
|
2004-01-02 16:17:42 +03:00
|
|
|
* continue handling the load and call the
|
|
|
|
* returned streamlistener's methods.
|
1999-10-30 01:46:18 +04:00
|
|
|
*/
|
2001-11-22 02:17:41 +03:00
|
|
|
boolean doContent(in string aContentType,
|
|
|
|
in boolean aIsContentPreferred,
|
|
|
|
in nsIRequest aRequest,
|
2001-03-21 22:21:34 +03:00
|
|
|
out nsIStreamListener aContentHandler);
|
1999-11-06 01:54:53 +03:00
|
|
|
|
2004-01-02 16:17:42 +03:00
|
|
|
/**
|
2001-11-22 02:17:41 +03:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param aContentType Content type of the data.
|
|
|
|
* @param aDesiredContentType Indicates that aContentType must be converted
|
|
|
|
* to aDesiredContentType before processing the
|
|
|
|
* data. This causes a stream converted to be
|
|
|
|
* inserted into the nsIStreamListener chain.
|
|
|
|
* This argument can be <code>nsnull</code> if
|
|
|
|
* the content should be consumed directly as
|
|
|
|
* aContentType.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this is a preferred
|
|
|
|
* content handler for aContentType;
|
|
|
|
* <code>false<code> otherwise.
|
2001-10-27 06:52:39 +04:00
|
|
|
*/
|
|
|
|
boolean isPreferred(in string aContentType, out string aDesiredContentType);
|
2000-02-04 11:43:34 +03:00
|
|
|
|
2001-11-22 02:17:41 +03:00
|
|
|
/**
|
|
|
|
* When given a uri to dispatch, if the URI is not specified as 'preferred
|
|
|
|
* content' then the uri loader calls canHandleContent to see if the content
|
|
|
|
* listener is capable of handling the content.
|
|
|
|
*
|
|
|
|
* @param aContentType Content type of the data.
|
|
|
|
* @param aIsContentPreferred Indicates whether the content should be
|
|
|
|
* preferred by this listener.
|
|
|
|
* @param aDesiredContentType Indicates that aContentType must be converted
|
|
|
|
* to aDesiredContentType before processing the
|
|
|
|
* data. This causes a stream converted to be
|
|
|
|
* inserted into the nsIStreamListener chain.
|
|
|
|
* This argument can be <code>nsnull</code> if
|
|
|
|
* the content should be consumed directly as
|
|
|
|
* aContentType.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the data can be consumed.
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*
|
|
|
|
* Note: I really envision canHandleContent as a method implemented
|
|
|
|
* by the docshell as the implementation is generic to all doc
|
|
|
|
* shells. The isPreferred decision is a decision made by a top level
|
|
|
|
* application content listener that sits at the top of the docshell
|
2004-07-10 03:05:53 +04:00
|
|
|
* hierarchy.
|
2001-10-27 06:52:39 +04:00
|
|
|
*/
|
2001-03-21 22:21:34 +03:00
|
|
|
boolean canHandleContent(in string aContentType,
|
2001-10-27 06:52:39 +04:00
|
|
|
in boolean aIsContentPreferred,
|
2001-03-21 22:21:34 +03:00
|
|
|
out string aDesiredContentType);
|
2001-11-22 02:17:41 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The load context associated with a particular content listener.
|
|
|
|
* The URI Loader stores and accesses this value as needed.
|
|
|
|
*/
|
2000-01-29 09:02:36 +03:00
|
|
|
attribute nsISupports loadCookie;
|
2001-10-27 06:52:39 +04:00
|
|
|
|
2001-11-22 02:17:41 +03:00
|
|
|
/**
|
|
|
|
* The parent content listener if this particular listener is part of a chain
|
|
|
|
* of content listeners (i.e. a docshell!)
|
2005-02-23 09:14:44 +03:00
|
|
|
*
|
|
|
|
* @note If this attribute is set to an object that implements
|
|
|
|
* nsISupportsWeakReference, the implementation should get the
|
|
|
|
* nsIWeakReference and hold that. Otherwise, the implementation
|
|
|
|
* should not refcount this interface; it should assume that a non
|
|
|
|
* null value is always valid. In that case, the caller is
|
|
|
|
* responsible for explicitly setting this value back to null if the
|
|
|
|
* parent content listener is destroyed.
|
2001-11-22 02:17:41 +03:00
|
|
|
*/
|
2000-01-29 09:02:36 +03:00
|
|
|
attribute nsIURIContentListener parentContentListener;
|
1999-10-30 01:46:18 +04:00
|
|
|
};
|
2001-11-22 02:17:41 +03:00
|
|
|
|