2002-03-10 08:24:48 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 20:52:41 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2002-03-10 08:24:48 +03: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/
|
2002-03-10 08:24:48 +03: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.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 20:52:41 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2002-03-10 08:24:48 +03:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-17 20:52:41 +04:00
|
|
|
* Blake Ross <blaker@netscape.com>
|
2002-03-10 08:24:48 +03:00
|
|
|
*
|
|
|
|
* 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"),
|
2002-03-10 08:24:48 +03: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
|
2002-03-10 08:24:48 +03: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.
|
2002-03-10 08:24:48 +03:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2002-03-13 01:13:45 +03:00
|
|
|
#include "nsISupports.idl"
|
2002-03-10 08:24:48 +03:00
|
|
|
|
|
|
|
interface nsIURI;
|
|
|
|
interface nsILocalFile;
|
|
|
|
interface nsIObserver;
|
|
|
|
interface nsIWebBrowserPersist;
|
2002-03-13 01:13:45 +03:00
|
|
|
interface nsIWebProgressListener;
|
2002-06-28 05:35:57 +04:00
|
|
|
interface nsIMIMEInfo;
|
2002-03-10 08:24:48 +03:00
|
|
|
|
2004-04-17 04:58:23 +04:00
|
|
|
[scriptable, uuid(d80095a7-e81c-464c-a13f-ecb84feb969f)]
|
|
|
|
interface nsITransfer : nsISupports {
|
2002-03-10 08:24:48 +03:00
|
|
|
|
2002-03-13 08:20:13 +03:00
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* Initializes the transfer with certain properties. This function must
|
2003-09-25 00:24:19 +04:00
|
|
|
* be called prior to accessing any properties on this interface.
|
2002-03-13 08:20:13 +03:00
|
|
|
*
|
2004-04-17 04:58:23 +04:00
|
|
|
* @param aSource The source URI of the transfer.
|
2002-03-13 08:20:13 +03:00
|
|
|
*
|
2004-04-17 04:58:23 +04:00
|
|
|
* @param aTarget The target URI of the transfer.
|
2002-03-13 08:20:13 +03:00
|
|
|
*
|
2004-04-17 04:58:23 +04:00
|
|
|
* @param aDisplayName The user-readable description of the transfer.
|
2002-03-13 08:20:13 +03:00
|
|
|
*
|
2004-04-17 04:58:23 +04:00
|
|
|
* @param aMIMEInfo The MIME info associated with the target,
|
2002-06-28 05:35:57 +04:00
|
|
|
* including MIME type and helper app when appropriate.
|
|
|
|
* This parameter is optional.
|
|
|
|
*
|
2004-04-17 04:58:23 +04:00
|
|
|
* @param aPersist The "persist" used for this transfer. If set,
|
|
|
|
* the manager will set its listener to the transfer item
|
2002-03-13 08:20:13 +03:00
|
|
|
* and use it for cancellation. If not set, the client
|
2004-04-17 04:58:23 +04:00
|
|
|
* is expected to set the transfer item as the listener on
|
2002-03-13 08:20:13 +03:00
|
|
|
* whatever transfer component is being used, and to
|
2004-04-17 04:58:23 +04:00
|
|
|
* set an observer on the transfer item that listens for
|
|
|
|
* the "oncancel" topic and cancels the transfer.
|
2002-03-13 08:20:13 +03:00
|
|
|
*/
|
2002-03-10 08:24:48 +03:00
|
|
|
void init(in nsIURI aSource,
|
2004-04-17 04:58:23 +04:00
|
|
|
in nsIURI aTarget,
|
2002-03-10 08:24:48 +03:00
|
|
|
in wstring aDisplayName,
|
2002-06-28 05:35:57 +04:00
|
|
|
in nsIMIMEInfo aMIMEInfo,
|
2002-03-16 01:58:43 +03:00
|
|
|
in long long startTime,
|
2002-03-10 08:24:48 +03:00
|
|
|
in nsIWebBrowserPersist aPersist);
|
2002-03-13 08:20:13 +03:00
|
|
|
|
2002-03-10 08:24:48 +03:00
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* The source of the transfer.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
|
|
|
readonly attribute nsIURI source;
|
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* The target of the transfer.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
2004-04-17 04:58:23 +04:00
|
|
|
readonly attribute nsIURI target;
|
2002-03-10 08:24:48 +03:00
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* Optional. If set, it will be used for cancellation, and the transfer
|
2002-03-10 08:24:48 +03:00
|
|
|
* will be set as its listener. If not, |observer| should be set to listen
|
|
|
|
* and respond accordingly to topics like oncancel, and the client promises
|
2004-04-17 04:58:23 +04:00
|
|
|
* to set the transfer item as the listener for whatever transfer component
|
|
|
|
* is being used.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
|
|
|
readonly attribute nsIWebBrowserPersist persist;
|
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* The percentage of transfer completed;
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
|
|
|
readonly attribute PRInt32 percentComplete;
|
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* The user-readable description of the transfer.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
|
|
|
attribute wstring displayName;
|
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* The time a transfer was started.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
2002-03-16 01:58:43 +03:00
|
|
|
readonly attribute long long startTime;
|
2002-03-10 08:24:48 +03:00
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* Optional. If set, it will contain the target's relevant MIME information.
|
2002-06-28 05:35:57 +04:00
|
|
|
* This includes it's MIME Type, helper app, and whether that helper should be
|
|
|
|
* executed.
|
2002-03-10 08:24:48 +03:00
|
|
|
*/
|
2002-06-28 05:35:57 +04:00
|
|
|
readonly attribute nsIMIMEInfo MIMEInfo;
|
2002-03-10 08:24:48 +03:00
|
|
|
|
|
|
|
/**
|
2004-04-17 04:58:23 +04:00
|
|
|
* Optional; transfering information is passed to this listener and used to
|
2002-03-10 08:24:48 +03:00
|
|
|
* update client UI.
|
|
|
|
*/
|
|
|
|
attribute nsIWebProgressListener listener;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If set, receives notifications of events like cancel ("oncancel").
|
|
|
|
* Must be set if no persist object is specified (see above).
|
|
|
|
*/
|
|
|
|
attribute nsIObserver observer;
|
|
|
|
};
|
|
|
|
|
2004-04-17 04:58:23 +04:00
|
|
|
[scriptable, uuid(b0aae798-78aa-4769-9f0e-9aef4cf9474d)]
|
|
|
|
interface nsIDownload : nsITransfer {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The target of a download is always a file on the local file system.
|
|
|
|
*/
|
|
|
|
readonly attribute nsILocalFile targetFile;
|
|
|
|
};
|
|
|
|
|
2002-03-10 08:24:48 +03:00
|
|
|
%{C++
|
2004-05-26 19:07:52 +04:00
|
|
|
/**
|
|
|
|
* A component with this contract ID will be created each time a download is
|
|
|
|
* started, and Init will be called on it and an observer will be set.
|
|
|
|
*
|
|
|
|
* Notifications of the download progress will happen via
|
|
|
|
* nsIWebProgressListener.
|
|
|
|
*
|
|
|
|
* If nsIObserver is implemented, the component may get a notification with
|
|
|
|
* topic "temp-file" and an nsILocalFile instance as subject, which indicates
|
|
|
|
* the location of a temporary file; i.e. a file in which the received data will
|
|
|
|
* be stored, but which is not equal to the target file.
|
|
|
|
*
|
|
|
|
* INTERFACES THAT NEED TO BE IMPLEMENTED:
|
|
|
|
* nsISupports
|
|
|
|
* nsITransfer
|
|
|
|
* nsIDownload
|
|
|
|
* nsIWebProgressListener
|
|
|
|
*
|
|
|
|
* INTERFACES THAT MAY BE IMPLEMENTED:
|
|
|
|
* nsIObserver
|
|
|
|
*/
|
2002-03-10 08:24:48 +03:00
|
|
|
#define NS_DOWNLOAD_CONTRACTID "@mozilla.org/download;1"
|
2004-05-26 19:07:52 +04:00
|
|
|
|
2002-03-10 08:24:48 +03:00
|
|
|
// {E3FA9D0A-1DD1-11B2-BDEF-8C720B597445}
|
|
|
|
#define NS_DOWNLOAD_CID \
|
|
|
|
{ 0xe3fa9d0a, 0x1dd1, 0x11b2, { 0xbd, 0xef, 0x8c, 0x72, 0x0b, 0x59, 0x74, 0x45 } }
|
2002-06-28 05:35:57 +04:00
|
|
|
%}
|