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