/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * 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/ * * 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 the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Darin Fisher (original author) * * Alternatively, the contents of this file may be used under the terms of * either 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"), * 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 * use your version of this file under the terms of the MPL, indicate your * 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 * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsIProtocolHandler.idl" interface nsIFile; [scriptable, uuid(1fb25bd5-4354-4dcd-8d97-621b7b3ed2e4)] interface nsIFileProtocolHandler : nsIProtocolHandler { /** * This method constructs a new file URI * * @param aFile nsIFile * @return reference to a new nsIURI object */ nsIURI newFileURI(in nsIFile aFile); /** * Converts the nsIFile to the corresponding URL string. NOTE: under * some platforms this is a lossy conversion (e.g., Mac Carbon build). * If the nsIFile is a local file, then the result will be a file:// * URL string. * * The resulting string may contain URL-escaped characters. * NOTE: Callers should use getURLSpecFromActualFile or * getURLSpecFromDirFile if possible, for performance reasons. */ AUTF8String getURLSpecFromFile(in nsIFile file); /** * Converts the nsIFile to the corresponding URL string. Should * only be called on files which are not directories. Otherwise * identical to getURLSpecFromFile, but is usually more efficient. * WARNING: This restriction may not be enforced at runtime! */ AUTF8String getURLSpecFromActualFile(in nsIFile file); /** * Converts the nsIFile to the corresponding URL string. Should * only be called on files which are directories. Otherwise * identical to getURLSpecFromFile, but is usually more efficient. * WARNING: This restriction may not be enforced at runtime! */ AUTF8String getURLSpecFromDir(in nsIFile file); /** * Converts the URL string into the corresponding nsIFile if possible. * A local file will be created if the URL string begins with file://. */ nsIFile getFileFromURLSpec(in AUTF8String url); /** * Takes a local file and tries to interpret it as an internet shortcut * (e.g. .url files on windows). * @param file The local file to read * @return The URI the file refers to * * @throw NS_ERROR_NOT_AVAILABLE if the OS does not support such files. * @throw NS_ERROR_NOT_AVAILABLE if this file is not an internet shortcut. */ nsIURI readURLFile(in nsIFile file); };