uriloader/base/nsIURIContentListener.idl

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIRequest;
michael@0 9 interface nsIStreamListener;
michael@0 10 interface nsIURI;
michael@0 11
michael@0 12 /**
michael@0 13 * nsIURIContentListener is an interface used by components which
michael@0 14 * want to know (and have a chance to handle) a particular content type.
michael@0 15 * Typical usage scenarios will include running applications which register
michael@0 16 * a nsIURIContentListener for each of its content windows with the uri
michael@0 17 * dispatcher service.
michael@0 18 */
michael@0 19 [scriptable, uuid(94928AB3-8B63-11d3-989D-001083010E9B)]
michael@0 20 interface nsIURIContentListener : nsISupports
michael@0 21 {
michael@0 22 /**
michael@0 23 * Gives the original content listener first crack at stopping a load before
michael@0 24 * it happens.
michael@0 25 *
michael@0 26 * @param aURI URI that is being opened.
michael@0 27 *
michael@0 28 * @return <code>false</code> if the load can continue;
michael@0 29 * <code>true</code> if the open should be aborted.
michael@0 30 */
michael@0 31 boolean onStartURIOpen(in nsIURI aURI);
michael@0 32
michael@0 33 /**
michael@0 34 * Notifies the content listener to hook up an nsIStreamListener capable of
michael@0 35 * consuming the data stream.
michael@0 36 *
michael@0 37 * @param aContentType Content type of the data.
michael@0 38 * @param aIsContentPreferred Indicates whether the content should be
michael@0 39 * preferred by this listener.
michael@0 40 * @param aRequest Request that is providing the data.
michael@0 41 * @param aContentHandler nsIStreamListener that will consume the data.
michael@0 42 * This should be set to <code>nullptr</code> if
michael@0 43 * this content listener can't handle the content
michael@0 44 * type; in this case, doContent should also fail
michael@0 45 * (i.e., return failure nsresult).
michael@0 46 *
michael@0 47 * @return <code>true</code> if the load should
michael@0 48 * be aborted and consumer wants to
michael@0 49 * handle the load completely by itself. This
michael@0 50 * causes the URI Loader do nothing else...
michael@0 51 * <code>false</code> if the URI Loader should
michael@0 52 * continue handling the load and call the
michael@0 53 * returned streamlistener's methods.
michael@0 54 */
michael@0 55 boolean doContent(in string aContentType,
michael@0 56 in boolean aIsContentPreferred,
michael@0 57 in nsIRequest aRequest,
michael@0 58 out nsIStreamListener aContentHandler);
michael@0 59
michael@0 60 /**
michael@0 61 * When given a uri to dispatch, if the URI is specified as 'preferred
michael@0 62 * content' then the uri loader tries to find a preferred content handler
michael@0 63 * for the content type. The thought is that many content listeners may
michael@0 64 * be able to handle the same content type if they have to. i.e. the mail
michael@0 65 * content window can handle text/html just like a browser window content
michael@0 66 * listener. However, if the user clicks on a link with text/html content,
michael@0 67 * then the browser window should handle that content and not the mail
michael@0 68 * window where the user may have clicked the link. This is the difference
michael@0 69 * between isPreferred and canHandleContent.
michael@0 70 *
michael@0 71 * @param aContentType Content type of the data.
michael@0 72 * @param aDesiredContentType Indicates that aContentType must be converted
michael@0 73 * to aDesiredContentType before processing the
michael@0 74 * data. This causes a stream converted to be
michael@0 75 * inserted into the nsIStreamListener chain.
michael@0 76 * This argument can be <code>nullptr</code> if
michael@0 77 * the content should be consumed directly as
michael@0 78 * aContentType.
michael@0 79 *
michael@0 80 * @return <code>true</code> if this is a preferred
michael@0 81 * content handler for aContentType;
michael@0 82 * <code>false<code> otherwise.
michael@0 83 */
michael@0 84 boolean isPreferred(in string aContentType, out string aDesiredContentType);
michael@0 85
michael@0 86 /**
michael@0 87 * When given a uri to dispatch, if the URI is not specified as 'preferred
michael@0 88 * content' then the uri loader calls canHandleContent to see if the content
michael@0 89 * listener is capable of handling the content.
michael@0 90 *
michael@0 91 * @param aContentType Content type of the data.
michael@0 92 * @param aIsContentPreferred Indicates whether the content should be
michael@0 93 * preferred by this listener.
michael@0 94 * @param aDesiredContentType Indicates that aContentType must be converted
michael@0 95 * to aDesiredContentType before processing the
michael@0 96 * data. This causes a stream converted to be
michael@0 97 * inserted into the nsIStreamListener chain.
michael@0 98 * This argument can be <code>nullptr</code> if
michael@0 99 * the content should be consumed directly as
michael@0 100 * aContentType.
michael@0 101 *
michael@0 102 * @return <code>true</code> if the data can be consumed.
michael@0 103 * <code>false</code> otherwise.
michael@0 104 *
michael@0 105 * Note: I really envision canHandleContent as a method implemented
michael@0 106 * by the docshell as the implementation is generic to all doc
michael@0 107 * shells. The isPreferred decision is a decision made by a top level
michael@0 108 * application content listener that sits at the top of the docshell
michael@0 109 * hierarchy.
michael@0 110 */
michael@0 111 boolean canHandleContent(in string aContentType,
michael@0 112 in boolean aIsContentPreferred,
michael@0 113 out string aDesiredContentType);
michael@0 114
michael@0 115 /**
michael@0 116 * The load context associated with a particular content listener.
michael@0 117 * The URI Loader stores and accesses this value as needed.
michael@0 118 */
michael@0 119 attribute nsISupports loadCookie;
michael@0 120
michael@0 121 /**
michael@0 122 * The parent content listener if this particular listener is part of a chain
michael@0 123 * of content listeners (i.e. a docshell!)
michael@0 124 *
michael@0 125 * @note If this attribute is set to an object that implements
michael@0 126 * nsISupportsWeakReference, the implementation should get the
michael@0 127 * nsIWeakReference and hold that. Otherwise, the implementation
michael@0 128 * should not refcount this interface; it should assume that a non
michael@0 129 * null value is always valid. In that case, the caller is
michael@0 130 * responsible for explicitly setting this value back to null if the
michael@0 131 * parent content listener is destroyed.
michael@0 132 */
michael@0 133 attribute nsIURIContentListener parentContentListener;
michael@0 134 };
michael@0 135

mercurial