netwerk/protocol/file/nsIFileProtocolHandler.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/file/nsIFileProtocolHandler.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,65 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsIProtocolHandler.idl"
    1.10 +
    1.11 +interface nsIFile;
    1.12 +
    1.13 +[scriptable, uuid(1fb25bd5-4354-4dcd-8d97-621b7b3ed2e4)]
    1.14 +interface nsIFileProtocolHandler : nsIProtocolHandler
    1.15 +{
    1.16 +    /**
    1.17 +     * This method constructs a new file URI 
    1.18 +     *
    1.19 +     * @param aFile nsIFile
    1.20 +     * @return reference to a new nsIURI object
    1.21 +     */
    1.22 +    nsIURI newFileURI(in nsIFile aFile);
    1.23 +
    1.24 +    /**
    1.25 +     * Converts the nsIFile to the corresponding URL string.  NOTE: under
    1.26 +     * some platforms this is a lossy conversion (e.g., Mac Carbon build).
    1.27 +     * If the nsIFile is a local file, then the result will be a file://
    1.28 +     * URL string.
    1.29 +     *
    1.30 +     * The resulting string may contain URL-escaped characters.
    1.31 +     * NOTE: Callers should use getURLSpecFromActualFile or
    1.32 +     * getURLSpecFromDirFile if possible, for performance reasons.
    1.33 +     */
    1.34 +    AUTF8String getURLSpecFromFile(in nsIFile file);
    1.35 +
    1.36 +    /**
    1.37 +     * Converts the nsIFile to the corresponding URL string. Should
    1.38 +     * only be called on files which are not directories. Otherwise
    1.39 +     * identical to getURLSpecFromFile, but is usually more efficient.
    1.40 +     * WARNING: This restriction may not be enforced at runtime! 
    1.41 +     */
    1.42 +    AUTF8String getURLSpecFromActualFile(in nsIFile file);
    1.43 +
    1.44 +    /**
    1.45 +     * Converts the nsIFile to the corresponding URL string. Should
    1.46 +     * only be called on files which are directories. Otherwise
    1.47 +     * identical to getURLSpecFromFile, but is usually more efficient.
    1.48 +     * WARNING: This restriction may not be enforced at runtime! 
    1.49 +     */
    1.50 +    AUTF8String getURLSpecFromDir(in nsIFile file);
    1.51 +
    1.52 +    /**
    1.53 +     * Converts the URL string into the corresponding nsIFile if possible.
    1.54 +     * A local file will be created if the URL string begins with file://.
    1.55 +     */
    1.56 +    nsIFile getFileFromURLSpec(in AUTF8String url);
    1.57 +
    1.58 +    /**
    1.59 +     * Takes a local file and tries to interpret it as an internet shortcut
    1.60 +     * (e.g. .url files on windows).
    1.61 +     * @param file The local file to read
    1.62 +     * @return The URI the file refers to
    1.63 +     *
    1.64 +     * @throw NS_ERROR_NOT_AVAILABLE if the OS does not support such files.
    1.65 +     * @throw NS_ERROR_NOT_AVAILABLE if this file is not an internet shortcut.
    1.66 +     */
    1.67 +    nsIURI readURLFile(in nsIFile file);
    1.68 +};

mercurial