Wed, 31 Dec 2014 06:09:35 +0100
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: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 "nsIMIMEInfo.idl" |
michael@0 | 7 | #include "nsIWebContentHandlerRegistrar.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsIRequest; |
michael@0 | 10 | |
michael@0 | 11 | [scriptable, uuid(eb361098-5158-4b21-8f98-50b445f1f0b2)] |
michael@0 | 12 | interface nsIWebContentHandlerInfo : nsIHandlerApp |
michael@0 | 13 | { |
michael@0 | 14 | /** |
michael@0 | 15 | * The content type handled by the handler |
michael@0 | 16 | */ |
michael@0 | 17 | readonly attribute AString contentType; |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * The uri of the handler, with an embedded %s where the URI of the loaded |
michael@0 | 21 | * document will be encoded. |
michael@0 | 22 | */ |
michael@0 | 23 | readonly attribute AString uri; |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Gets the service URL Spec, with the loading document URI encoded in it. |
michael@0 | 27 | * @param uri |
michael@0 | 28 | * The URI of the document being loaded |
michael@0 | 29 | * @returns The URI of the service with the loading document URI encoded in |
michael@0 | 30 | * it. |
michael@0 | 31 | */ |
michael@0 | 32 | AString getHandlerURI(in AString uri); |
michael@0 | 33 | }; |
michael@0 | 34 | |
michael@0 | 35 | [scriptable, uuid(de7cc06e-e778-45cb-b7db-7a114e1e75b1)] |
michael@0 | 36 | interface nsIWebContentConverterService : nsIWebContentHandlerRegistrar |
michael@0 | 37 | { |
michael@0 | 38 | /** |
michael@0 | 39 | * Specifies the handler to be used to automatically handle all links of a |
michael@0 | 40 | * certain content type from now on. |
michael@0 | 41 | * @param contentType |
michael@0 | 42 | * The content type to automatically load with the specified handler |
michael@0 | 43 | * @param handler |
michael@0 | 44 | * A web service handler. If this is null, no automatic action is |
michael@0 | 45 | * performed and the user must choose. |
michael@0 | 46 | * @throws NS_ERROR_NOT_AVAILABLE if the service refered to by |handler| is |
michael@0 | 47 | * not already registered. |
michael@0 | 48 | */ |
michael@0 | 49 | void setAutoHandler(in AString contentType, in nsIWebContentHandlerInfo handler); |
michael@0 | 50 | |
michael@0 | 51 | /** |
michael@0 | 52 | * Gets the auto handler specified for a particular content type |
michael@0 | 53 | * @param contentType |
michael@0 | 54 | * The content type to look up an auto handler for. |
michael@0 | 55 | * @returns The web service handler that will automatically handle all |
michael@0 | 56 | * documents of the specified type. null if there is no automatic |
michael@0 | 57 | * handler. (Handlers may be registered, just none of them specified |
michael@0 | 58 | * as "automatic"). |
michael@0 | 59 | */ |
michael@0 | 60 | nsIWebContentHandlerInfo getAutoHandler(in AString contentType); |
michael@0 | 61 | |
michael@0 | 62 | /** |
michael@0 | 63 | * Gets a web handler for the specified service URI |
michael@0 | 64 | * @param contentType |
michael@0 | 65 | * The content type of the service being located |
michael@0 | 66 | * @param uri |
michael@0 | 67 | * The service URI of the handler to locate. |
michael@0 | 68 | * @returns A web service handler that uses the specified uri. |
michael@0 | 69 | */ |
michael@0 | 70 | nsIWebContentHandlerInfo getWebContentHandlerByURI(in AString contentType, |
michael@0 | 71 | in AString uri); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Loads the preferred handler when content of a registered type is about |
michael@0 | 75 | * to be loaded. |
michael@0 | 76 | * @param request |
michael@0 | 77 | * The nsIRequest for the load of the content |
michael@0 | 78 | */ |
michael@0 | 79 | void loadPreferredHandler(in nsIRequest request); |
michael@0 | 80 | |
michael@0 | 81 | /** |
michael@0 | 82 | * Removes a registered protocol handler |
michael@0 | 83 | * @param protocol |
michael@0 | 84 | * The protocol scheme to remove a service handler for |
michael@0 | 85 | * @param uri |
michael@0 | 86 | * The uri of the service handler to remove |
michael@0 | 87 | */ |
michael@0 | 88 | void removeProtocolHandler(in AString protocol, in AString uri); |
michael@0 | 89 | |
michael@0 | 90 | /** |
michael@0 | 91 | * Removes a registered content handler |
michael@0 | 92 | * @param contentType |
michael@0 | 93 | * The content type to remove a service handler for |
michael@0 | 94 | * @param uri |
michael@0 | 95 | * The uri of the service handler to remove |
michael@0 | 96 | */ |
michael@0 | 97 | void removeContentHandler(in AString contentType, in AString uri); |
michael@0 | 98 | |
michael@0 | 99 | /** |
michael@0 | 100 | * Gets the list of content handlers for a particular type. |
michael@0 | 101 | * @param contentType |
michael@0 | 102 | * The content type to get handlers for |
michael@0 | 103 | * @returns An array of nsIWebContentHandlerInfo objects |
michael@0 | 104 | */ |
michael@0 | 105 | void getContentHandlers(in AString contentType, |
michael@0 | 106 | [optional] out unsigned long count, |
michael@0 | 107 | [retval,array,size_is(count)] out nsIWebContentHandlerInfo handlers); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Resets the list of available content handlers to the default set from |
michael@0 | 111 | * the distribution. |
michael@0 | 112 | * @param contentType |
michael@0 | 113 | * The content type to reset handlers for |
michael@0 | 114 | */ |
michael@0 | 115 | void resetHandlersForType(in AString contentType); |
michael@0 | 116 | }; |
michael@0 | 117 |