michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIMIMEInfo.idl" michael@0: #include "nsIWebContentHandlerRegistrar.idl" michael@0: michael@0: interface nsIRequest; michael@0: michael@0: [scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)] michael@0: interface nsIWebContentHandlerInfo : nsIHandlerApp michael@0: { michael@0: /** michael@0: * The content type handled by the handler michael@0: */ michael@0: readonly attribute AString contentType; michael@0: michael@0: /** michael@0: * The uri of the handler, with an embedded %s where the URI of the loaded michael@0: * document will be encoded. michael@0: */ michael@0: readonly attribute AString uri; michael@0: michael@0: /** michael@0: * Gets the service URL Spec, with the loading document URI encoded in it. michael@0: * @param uri michael@0: * The URI of the document being loaded michael@0: * @returns The URI of the service with the loading document URI encoded in michael@0: * it. michael@0: */ michael@0: AString getHandlerURI(in AString uri); michael@0: }; michael@0: michael@0: [scriptable, uuid(de7cc06e-e778-45cb-b7db-7a114e1e75b1)] michael@0: interface nsIWebContentConverterService : nsIWebContentHandlerRegistrar michael@0: { michael@0: /** michael@0: * Specifies the handler to be used to automatically handle all links of a michael@0: * certain content type from now on. michael@0: * @param contentType michael@0: * The content type to automatically load with the specified handler michael@0: * @param handler michael@0: * A web service handler. If this is null, no automatic action is michael@0: * performed and the user must choose. michael@0: * @throws NS_ERROR_NOT_AVAILABLE if the service refered to by |handler| is michael@0: * not already registered. michael@0: */ michael@0: void setAutoHandler(in AString contentType, in nsIWebContentHandlerInfo handler); michael@0: michael@0: /** michael@0: * Gets the auto handler specified for a particular content type michael@0: * @param contentType michael@0: * The content type to look up an auto handler for. michael@0: * @returns The web service handler that will automatically handle all michael@0: * documents of the specified type. null if there is no automatic michael@0: * handler. (Handlers may be registered, just none of them specified michael@0: * as "automatic"). michael@0: */ michael@0: nsIWebContentHandlerInfo getAutoHandler(in AString contentType); michael@0: michael@0: /** michael@0: * Gets a web handler for the specified service URI michael@0: * @param contentType michael@0: * The content type of the service being located michael@0: * @param uri michael@0: * The service URI of the handler to locate. michael@0: * @returns A web service handler that uses the specified uri. michael@0: */ michael@0: nsIWebContentHandlerInfo getWebContentHandlerByURI(in AString contentType, michael@0: in AString uri); michael@0: michael@0: /** michael@0: * Loads the preferred handler when content of a registered type is about michael@0: * to be loaded. michael@0: * @param request michael@0: * The nsIRequest for the load of the content michael@0: */ michael@0: void loadPreferredHandler(in nsIRequest request); michael@0: michael@0: /** michael@0: * Removes a registered protocol handler michael@0: * @param protocol michael@0: * The protocol scheme to remove a service handler for michael@0: * @param uri michael@0: * The uri of the service handler to remove michael@0: */ michael@0: void removeProtocolHandler(in AString protocol, in AString uri); michael@0: michael@0: /** michael@0: * Removes a registered content handler michael@0: * @param contentType michael@0: * The content type to remove a service handler for michael@0: * @param uri michael@0: * The uri of the service handler to remove michael@0: */ michael@0: void removeContentHandler(in AString contentType, in AString uri); michael@0: michael@0: /** michael@0: * Gets the list of content handlers for a particular type. michael@0: * @param contentType michael@0: * The content type to get handlers for michael@0: * @returns An array of nsIWebContentHandlerInfo objects michael@0: */ michael@0: void getContentHandlers(in AString contentType, michael@0: [optional] out unsigned long count, michael@0: [retval,array,size_is(count)] out nsIWebContentHandlerInfo handlers); michael@0: michael@0: /** michael@0: * Resets the list of available content handlers to the default set from michael@0: * the distribution. michael@0: * @param contentType michael@0: * The content type to reset handlers for michael@0: */ michael@0: void resetHandlersForType(in AString contentType); michael@0: }; michael@0: