Interface nsIExternalProtocolServiceType

The external protocol service is used for finding and launching web handlers (a la registerProtocolHandler in the HTML5 draft) or platform-specific applications for handling particular protocols.

You can ask the external protocol service if it has an external handler for a given protocol scheme. And you can ask it to load the url using the default handler.

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Check whether a handler for a specific protocol exists. Specifically, this looks to see whether there are any known possible application handlers in either the nsIHandlerService datastore or registered with the OS.

    Returns

    true if we have a handler and false otherwise.

    XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?

    Parameters

    • aProtocolScheme: string

      The scheme from a url: http, ftp, mailto, etc.

    Returns boolean

  • Gets a human-readable description for the application responsible for handling a specific protocol.

    Throw

    NS_ERROR_NOT_IMPLEMENTED If getting descriptions for protocol helpers is not supported

    Throw

    NS_ERROR_NOT_AVAILABLE If no protocol helper exists for this scheme, or if it is not possible to get a description for it.

    Parameters

    • aScheme: string

      The scheme to look up. For example, "mms".

    Returns string

  • Retrieve the handler for the given protocol. If neither the application nor the OS knows about a handler for the protocol, the object this method returns will represent a default handler for unknown content.

    Returns

    the handler, if any; otherwise a default handler

    Parameters

    • aProtocolScheme: string

      the scheme from a URL: http, ftp, mailto, etc.

      Note: aProtocolScheme should not include a trailing colon, which is part of the URI syntax, not part of the scheme itself (i.e. pass "mailto" not "mailto:").

    Returns nsIHandlerInfo

  • Given a scheme, looks up the protocol info from the OS. This should be overridden by each OS's implementation.

    Returns

    An nsIHanderInfo for the protocol.

    Parameters

    • aProtocolScheme: string
    • aFound: boolean

      Was an OS default handler for this scheme found?

    Returns nsIHandlerInfo

  • Check if this app is registered as the OS default for a given scheme.

    Parameters

    • aScheme: string

      The scheme to look up. For example, "mms".

    Returns bool

  • Check whether a handler for a specific protocol is "exposed" as a visible feature of the current application.

    An exposed protocol handler is one that can be used in all contexts. A non-exposed protocol handler is one that can only be used internally by the application. For example, a non-exposed protocol would not be loaded by the application in response to a link click or a X-remote openURL command. Instead, it would be deferred to the system's external protocol handler. XXX shouldn't aProtocolScheme be an ACString like nsIURI::scheme?

    Parameters

    • aProtocolScheme: string

    Returns boolean

  • Used to load a URI via an external application. Might prompt the user for permission to load the external application.

    Note

    Embedders that do not expose the http protocol should not currently use web-based protocol handlers, as handoff won't work correctly (bug 394479).

    Parameters

    • aURI: nsIURI

      The URI to load

    • aTriggeringPrincipal: nsIPrincipal

      The principal triggering this load.

    • aRedirectPrincipal: nsIPrincipal

      The last post-redirect principal triggering this load. Used for display and permission purposes. If null, we'll use the triggering principal.

    • aBrowsingContext: BrowsingContext

      The context to parent the dialog against, and, if a web handler is chosen, it is loaded in this window as well. This parameter may be ultimately passed nsIURILoader.openURI in the case of a web handler, and aWindowContext is null or not present, web handlers will fail. We need to do better than that; bug 394483 filed in order to track.

    • aWasTriggeredExternally: bool

      If true, indicates the load was initiated by an external app.

    • aHasValidUserGestureActivation: bool

      Whether the document that triggered the load had user activation. Used for sandbox checks.

    Returns void

  • Set some sane defaults for a protocol handler object.

    Parameters

    • aHandlerInfo: nsIHandlerInfo

      nsIHandlerInfo object, as returned by getProtocolHandlerInfoFromOS

    • aOSHandlerExists: boolean

      was the object above created for an extant OS default handler? This is generally the value of the aFound out param from getProtocolHandlerInfoFromOS.

    Returns void

Generated using TypeDoc