1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/uriloader/base/nsIURILoader.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,140 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIURIContentListener; 1.12 +interface nsIURI; 1.13 +interface nsILoadGroup; 1.14 +interface nsIProgressEventSink; 1.15 +interface nsIChannel; 1.16 +interface nsIRequest; 1.17 +interface nsIStreamListener; 1.18 +interface nsIInputStream; 1.19 +interface nsIInterfaceRequestor; 1.20 + 1.21 +/** 1.22 + * The uri dispatcher is responsible for taking uri's, determining 1.23 + * the content and routing the opened url to the correct content 1.24 + * handler. 1.25 + * 1.26 + * When you encounter a url you want to open, you typically call 1.27 + * openURI, passing it the content listener for the window the uri is 1.28 + * originating from. The uri dispatcher opens the url to discover the 1.29 + * content type. It then gives the content listener first crack at 1.30 + * handling the content. If it doesn't want it, the dispatcher tries 1.31 + * to hand it off one of the registered content listeners. This allows 1.32 + * running applications the chance to jump in and handle the content. 1.33 + * 1.34 + * If that also fails, then the uri dispatcher goes to the registry 1.35 + * looking for the preferred content handler for the content type 1.36 + * of the uri. The content handler may create an app instance 1.37 + * or it may hand the contents off to a platform specific plugin 1.38 + * or helper app. Or it may hand the url off to an OS registered 1.39 + * application. 1.40 + */ 1.41 +[scriptable, uuid(8762c4e7-be35-4958-9b81-a05685bb516d)] 1.42 +interface nsIURILoader : nsISupports 1.43 +{ 1.44 + /** 1.45 + * @name Flags for opening URIs. 1.46 + */ 1.47 + /* @{ */ 1.48 + /** 1.49 + * Should the content be displayed in a container that prefers the 1.50 + * content-type, or will any container do. 1.51 + */ 1.52 + const unsigned long IS_CONTENT_PREFERRED = 1 << 0; 1.53 + /** 1.54 + * If this flag is set, only the listener of the specified window context will 1.55 + * be considered for content handling; if it refuses the load, an error will 1.56 + * be indicated. 1.57 + */ 1.58 + const unsigned long DONT_RETARGET = 1 << 1; 1.59 + /* @} */ 1.60 + 1.61 + /** 1.62 + * As applications such as messenger and the browser are instantiated, 1.63 + * they register content listener's with the uri dispatcher corresponding 1.64 + * to content windows within that application. 1.65 + * 1.66 + * Note to self: we may want to optimize things a bit more by requiring 1.67 + * the content types the registered content listener cares about. 1.68 + * 1.69 + * @param aContentListener 1.70 + * The listener to register. This listener must implement 1.71 + * nsISupportsWeakReference. 1.72 + * 1.73 + * @see the nsIURILoader class description 1.74 + */ 1.75 + void registerContentListener (in nsIURIContentListener aContentListener); 1.76 + void unRegisterContentListener (in nsIURIContentListener aContentListener); 1.77 + 1.78 + /** 1.79 + * OpenURI requires the following parameters..... 1.80 + * @param aChannel 1.81 + * The channel that should be opened. This must not be asyncOpen'd yet! 1.82 + * If a loadgroup is set on the channel, it will get replaced with a 1.83 + * different one. 1.84 + * @param aFlags 1.85 + * Combination (bitwise OR) of the flags specified above. 0 indicates 1.86 + * default handling. 1.87 + * @param aWindowContext 1.88 + * If you are running the url from a doc shell or a web shell, this is 1.89 + * your window context. If you have a content listener you want to 1.90 + * give first crack to, the uri loader needs to be able to get it 1.91 + * from the window context. We will also be using the window context 1.92 + * to get at the progress event sink interface. 1.93 + * <b>Must not be null!</b> 1.94 + */ 1.95 + void openURI(in nsIChannel aChannel, 1.96 + in unsigned long aFlags, 1.97 + in nsIInterfaceRequestor aWindowContext); 1.98 + 1.99 + /** 1.100 + * Loads data from a channel. This differs from openURI in that the channel 1.101 + * may already be opened, and that it returns a stream listener into which the 1.102 + * caller should pump data. The caller is responsible for opening the channel 1.103 + * and pumping the channel's data into the returned stream listener. 1.104 + * 1.105 + * Note: If the channel already has a loadgroup, it will be replaced with the 1.106 + * window context's load group, or null if the context doesn't have one. 1.107 + * 1.108 + * If the window context's nsIURIContentListener refuses the load immediately 1.109 + * (e.g. in nsIURIContentListener::onStartURIOpen), this method will return 1.110 + * NS_ERROR_WONT_HANDLE_CONTENT. At that point, the caller should probably 1.111 + * cancel the channel if it's already open (this method will not cancel the 1.112 + * channel). 1.113 + * 1.114 + * If flags include DONT_RETARGET, and the content listener refuses the load 1.115 + * during onStartRequest (e.g. in canHandleContent/isPreferred), then the 1.116 + * returned stream listener's onStartRequest method will return 1.117 + * NS_ERROR_WONT_HANDLE_CONTENT. 1.118 + * 1.119 + * @param aChannel 1.120 + * The channel that should be loaded. The channel may already be 1.121 + * opened. It must not be closed (i.e. this must be called before the 1.122 + * channel calls onStopRequest on its stream listener). 1.123 + * @param aFlags 1.124 + * Combination (bitwise OR) of the flags specified above. 0 indicates 1.125 + * default handling. 1.126 + * @param aWindowContext 1.127 + * If you are running the url from a doc shell or a web shell, this is 1.128 + * your window context. If you have a content listener you want to 1.129 + * give first crack to, the uri loader needs to be able to get it 1.130 + * from the window context. We will also be using the window context 1.131 + * to get at the progress event sink interface. 1.132 + * <b>Must not be null!</b> 1.133 + */ 1.134 + nsIStreamListener openChannel(in nsIChannel aChannel, 1.135 + in unsigned long aFlags, 1.136 + in nsIInterfaceRequestor aWindowContext); 1.137 + 1.138 + /** 1.139 + * Stops an in progress load 1.140 + */ 1.141 + void stop(in nsISupports aLoadCookie); 1.142 +}; 1.143 +