/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * The contents of this file are subject to the Netscape 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/NPL/
 *
 * 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.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s): 
 */

#include "nsISupports.idl"
#include "nsIChannel.idl"

interface nsIObserver;
interface nsILocalFile;

/*------------------------- nsIStreamTransferOperation -------------------------
| This interface is provided to enable the JavaScript portion of the standard  |
| implementation of nsIStreamTransfer to communicate with the underlying       |
| C++ code that performs the actual network/file I/O.                          |
|                                                                              |
| Thus, it is only of interest to the implementor's of the code in             |
| downloadProgress.xul/downloadProgress.js.                                    |
------------------------------------------------------------------------------*/
[scriptable, uuid(E2200F90-3E23-11d3-806A-00600811A9C3)]
interface nsIStreamTransferOperation : nsISupports {
    readonly attribute nsIChannel  source;
    readonly attribute nsILocalFile target;

    attribute nsIObserver observer;

    void Start();
    void Stop();

    // Operation codes (for error notifications):
    const unsigned long kOpAsyncWrite       = 1;
    const unsigned long kOpWrite            = 2;
    const unsigned long kOpOpenOutputStream = 3;
    const unsigned long kOpCreateTransport  = 4;
    const unsigned long kOpGetService       = 5;
    const unsigned long kOpInputCancel      = 6;
    const unsigned long kOpOutputClose      = 8;
    const unsigned long kOpOutputCancel     = 9;
    const unsigned long kOpRead             = 10;
    const unsigned long kOpCreateFile       = 11;
    const unsigned long kOpAsyncRead        = 12;

    // Reason codes (for write errors):
    const unsigned long kReasonAccessError  = 1;
    const unsigned long kReasonDiskFull     = 2;
};
