1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
24 * Scott MacGregor <mscott@netscape.com>
25 * Myk Melez <myk@mozilla.org>
26 * Dan Mosedale <dmose@mozilla.org>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #include
"nsISupports.idl"
46 interface nsIInterfaceRequestor
;
47 interface nsIHandlerInfo
;
50 * The external protocol service is used for finding and launching
51 * web handlers (a la registerProtocolHandler in the HTML5 draft) or
52 * platform-specific applications for handling particular protocols.
54 * You can ask the external protocol service if it has an external
55 * handler for a given protocol scheme. And you can ask it to load
56 * the url using the default handler.
58 [scriptable
, uuid(70f93b7a
-3ec6
-4bcb
-b093
-92d9984c9f83
)]
59 interface nsIExternalProtocolService
: nsISupports
62 * Check whether a handler for a specific protocol exists. Specifically,
63 * this looks to see whether there are any known possible application handlers
64 * in either the nsIHandlerService datastore or registered with the OS.
66 * @param aProtocolScheme The scheme from a url: http, ftp, mailto, etc.
68 * @return true if we have a handler and false otherwise.
70 * XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?
72 boolean externalProtocolHandlerExists
(in string aProtocolScheme
);
75 * Check whether a handler for a specific protocol is "exposed" as a visible
76 * feature of the current application.
78 * An exposed protocol handler is one that can be used in all contexts. A
79 * non-exposed protocol handler is one that can only be used internally by the
80 * application. For example, a non-exposed protocol would not be loaded by the
81 * application in response to a link click or a X-remote openURL command.
82 * Instead, it would be deferred to the system's external protocol handler.
83 * XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?
85 boolean isExposedProtocol
(in string aProtocolScheme
);
88 * Retrieve the handler for the given protocol. If neither the application
89 * nor the OS knows about a handler for the protocol, the object this method
90 * returns will represent a default handler for unknown content.
92 * @param aProtocolScheme the scheme from a URL: http, ftp, mailto, etc.
94 * Note: aProtocolScheme should not include a trailing colon, which is part
95 * of the URI syntax, not part of the scheme itself (i.e. pass "mailto" not
98 * @return the handler, if any; otherwise a default handler
100 nsIHandlerInfo getProtocolHandlerInfo
(in ACString aProtocolScheme
);
103 * Given a scheme, looks up the protocol info from the OS. This should be
104 * overridden by each OS's implementation.
106 * @param aScheme The protocol scheme we are looking for.
107 * @param aFound Was an OS default handler for this scheme found?
108 * @return An nsIHanderInfo for the protocol.
110 nsIHandlerInfo getProtocolHandlerInfoFromOS
(in ACString aProtocolScheme
,
114 * Set some sane defaults for a protocol handler object.
116 * @param aHandlerInfo nsIHandlerInfo object, as returned by
117 * getProtocolHandlerInfoFromOS
118 * @param aOSHandlerExists was the object above created for an extant
119 * OS default handler? This is generally the
120 * value of the aFound out param from
121 * getProtocolHandlerInfoFromOS.
123 void setProtocolHandlerDefaults
(in nsIHandlerInfo aHandlerInfo
,
124 in boolean aOSHandlerExists
);
127 * Used to load a url via an external protocol handler (if one exists)
129 * @param aURL The url to load
130 * @deprecated Use LoadURI instead (See Bug 389565 for removal)
132 void loadUrl
(in nsIURI aURL
);
135 * Used to load a URI via an external application. Might prompt the user for
136 * permission to load the external application.
141 * @param aWindowContext
142 * The window to parent the dialog against, and, if a web handler
143 * is chosen, it is loaded in this window as well. This parameter
144 * may be ultimately passed nsIURILoader.openURI in the case of a
145 * web handler, and aWindowContext is null or not present, web
146 * handlers will fail. We need to do better than that; bug 394483
147 * filed in order to track.
149 * @note Embedders that do not expose the http protocol should not currently
150 * use web-based protocol handlers, as handoff won't work correctly
153 void loadURI
(in nsIURI aURI
,
154 [optional] in nsIInterfaceRequestor aWindowContext
);
157 * Gets a human-readable description for the application responsible for
158 * handling a specific protocol.
160 * @param aScheme The scheme to look up. For example, "mms".
162 * @throw NS_ERROR_NOT_IMPLEMENTED
163 * If getting descriptions for protocol helpers is not supported
164 * @throw NS_ERROR_NOT_AVAILABLE
165 * If no protocol helper exists for this scheme, or if it is not
166 * possible to get a description for it.
168 AString getApplicationDescription
(in AUTF8String aScheme
);