netwerk/protocol/file/nsIFileProtocolHandler.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsIProtocolHandler.idl"
michael@0 7
michael@0 8 interface nsIFile;
michael@0 9
michael@0 10 [scriptable, uuid(1fb25bd5-4354-4dcd-8d97-621b7b3ed2e4)]
michael@0 11 interface nsIFileProtocolHandler : nsIProtocolHandler
michael@0 12 {
michael@0 13 /**
michael@0 14 * This method constructs a new file URI
michael@0 15 *
michael@0 16 * @param aFile nsIFile
michael@0 17 * @return reference to a new nsIURI object
michael@0 18 */
michael@0 19 nsIURI newFileURI(in nsIFile aFile);
michael@0 20
michael@0 21 /**
michael@0 22 * Converts the nsIFile to the corresponding URL string. NOTE: under
michael@0 23 * some platforms this is a lossy conversion (e.g., Mac Carbon build).
michael@0 24 * If the nsIFile is a local file, then the result will be a file://
michael@0 25 * URL string.
michael@0 26 *
michael@0 27 * The resulting string may contain URL-escaped characters.
michael@0 28 * NOTE: Callers should use getURLSpecFromActualFile or
michael@0 29 * getURLSpecFromDirFile if possible, for performance reasons.
michael@0 30 */
michael@0 31 AUTF8String getURLSpecFromFile(in nsIFile file);
michael@0 32
michael@0 33 /**
michael@0 34 * Converts the nsIFile to the corresponding URL string. Should
michael@0 35 * only be called on files which are not directories. Otherwise
michael@0 36 * identical to getURLSpecFromFile, but is usually more efficient.
michael@0 37 * WARNING: This restriction may not be enforced at runtime!
michael@0 38 */
michael@0 39 AUTF8String getURLSpecFromActualFile(in nsIFile file);
michael@0 40
michael@0 41 /**
michael@0 42 * Converts the nsIFile to the corresponding URL string. Should
michael@0 43 * only be called on files which are directories. Otherwise
michael@0 44 * identical to getURLSpecFromFile, but is usually more efficient.
michael@0 45 * WARNING: This restriction may not be enforced at runtime!
michael@0 46 */
michael@0 47 AUTF8String getURLSpecFromDir(in nsIFile file);
michael@0 48
michael@0 49 /**
michael@0 50 * Converts the URL string into the corresponding nsIFile if possible.
michael@0 51 * A local file will be created if the URL string begins with file://.
michael@0 52 */
michael@0 53 nsIFile getFileFromURLSpec(in AUTF8String url);
michael@0 54
michael@0 55 /**
michael@0 56 * Takes a local file and tries to interpret it as an internet shortcut
michael@0 57 * (e.g. .url files on windows).
michael@0 58 * @param file The local file to read
michael@0 59 * @return The URI the file refers to
michael@0 60 *
michael@0 61 * @throw NS_ERROR_NOT_AVAILABLE if the OS does not support such files.
michael@0 62 * @throw NS_ERROR_NOT_AVAILABLE if this file is not an internet shortcut.
michael@0 63 */
michael@0 64 nsIURI readURLFile(in nsIFile file);
michael@0 65 };

mercurial