1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
11 interface nsIInterfaceRequestor
;
12 interface nsIHandlerInfo
;
15 * The external protocol service is used for finding and launching
16 * web handlers (a la registerProtocolHandler in the HTML5 draft) or
17 * platform-specific applications for handling particular protocols.
19 * You can ask the external protocol service if it has an external
20 * handler for a given protocol scheme. And you can ask it to load
21 * the url using the default handler.
23 [scriptable
, uuid(70f93b7a
-3ec6
-4bcb
-b093
-92d9984c9f83
)]
24 interface nsIExternalProtocolService
: nsISupports
27 * Check whether a handler for a specific protocol exists. Specifically,
28 * this looks to see whether there are any known possible application handlers
29 * in either the nsIHandlerService datastore or registered with the OS.
31 * @param aProtocolScheme The scheme from a url: http, ftp, mailto, etc.
33 * @return true if we have a handler and false otherwise.
35 * XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?
37 boolean externalProtocolHandlerExists
(in string aProtocolScheme
);
40 * Check whether a handler for a specific protocol is "exposed" as a visible
41 * feature of the current application.
43 * An exposed protocol handler is one that can be used in all contexts. A
44 * non-exposed protocol handler is one that can only be used internally by the
45 * application. For example, a non-exposed protocol would not be loaded by the
46 * application in response to a link click or a X-remote openURL command.
47 * Instead, it would be deferred to the system's external protocol handler.
48 * XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?
50 boolean isExposedProtocol
(in string aProtocolScheme
);
53 * Retrieve the handler for the given protocol. If neither the application
54 * nor the OS knows about a handler for the protocol, the object this method
55 * returns will represent a default handler for unknown content.
57 * @param aProtocolScheme the scheme from a URL: http, ftp, mailto, etc.
59 * Note: aProtocolScheme should not include a trailing colon, which is part
60 * of the URI syntax, not part of the scheme itself (i.e. pass "mailto" not
63 * @return the handler, if any; otherwise a default handler
65 nsIHandlerInfo getProtocolHandlerInfo
(in ACString aProtocolScheme
);
68 * Given a scheme, looks up the protocol info from the OS. This should be
69 * overridden by each OS's implementation.
71 * @param aScheme The protocol scheme we are looking for.
72 * @param aFound Was an OS default handler for this scheme found?
73 * @return An nsIHanderInfo for the protocol.
75 nsIHandlerInfo getProtocolHandlerInfoFromOS
(in ACString aProtocolScheme
,
79 * Set some sane defaults for a protocol handler object.
81 * @param aHandlerInfo nsIHandlerInfo object, as returned by
82 * getProtocolHandlerInfoFromOS
83 * @param aOSHandlerExists was the object above created for an extant
84 * OS default handler? This is generally the
85 * value of the aFound out param from
86 * getProtocolHandlerInfoFromOS.
88 void setProtocolHandlerDefaults
(in nsIHandlerInfo aHandlerInfo
,
89 in boolean aOSHandlerExists
);
92 * Used to load a url via an external protocol handler (if one exists)
94 * @param aURL The url to load
96 * @deprecated Use LoadURI instead (See Bug 389565 for removal)
98 [deprecated
] void loadUrl
(in nsIURI aURL
);
101 * Used to load a URI via an external application. Might prompt the user for
102 * permission to load the external application.
107 * @param aWindowContext
108 * The window to parent the dialog against, and, if a web handler
109 * is chosen, it is loaded in this window as well. This parameter
110 * may be ultimately passed nsIURILoader.openURI in the case of a
111 * web handler, and aWindowContext is null or not present, web
112 * handlers will fail. We need to do better than that; bug 394483
113 * filed in order to track.
115 * @note Embedders that do not expose the http protocol should not currently
116 * use web-based protocol handlers, as handoff won't work correctly
119 void loadURI
(in nsIURI aURI
,
120 [optional] in nsIInterfaceRequestor aWindowContext
);
123 * Gets a human-readable description for the application responsible for
124 * handling a specific protocol.
126 * @param aScheme The scheme to look up. For example, "mms".
128 * @throw NS_ERROR_NOT_IMPLEMENTED
129 * If getting descriptions for protocol helpers is not supported
130 * @throw NS_ERROR_NOT_AVAILABLE
131 * If no protocol helper exists for this scheme, or if it is not
132 * possible to get a description for it.
134 AString getApplicationDescription
(in AUTF8String aScheme
);