michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIDOMDragEvent; michael@0: interface nsIURI; michael@0: michael@0: [scriptable, uuid(6B58A5A7-76D0-4E93-AB2E-4DE108683FF8)] michael@0: interface nsIDroppedLinkHandler : nsISupports michael@0: { michael@0: /** michael@0: * Determines if a link being dragged can be dropped and returns true if so. michael@0: * aEvent should be a dragenter or dragover event. michael@0: * michael@0: * If aAllowSameDocument is false, drops are only allowed if the document michael@0: * of the source of the drag is different from the destination. This check michael@0: * includes any parent, sibling and child frames in the same content tree. michael@0: * If true, the source is not checked. michael@0: */ michael@0: boolean canDropLink(in nsIDOMDragEvent aEvent, in boolean aAllowSameDocument); michael@0: michael@0: /** michael@0: * Given a drop event aEvent, determines the link being dragged and returns michael@0: * it. If a uri is returned the caller can, for instance, load it. If null michael@0: * is returned, there is no valid link to be dropped. michael@0: * michael@0: * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if michael@0: * the receiving target should not load the uri for security reasons. This michael@0: * will occur if any of the following conditions are true: michael@0: * - the source of the drag initiated a link for dragging that michael@0: * it itself cannot access. This prevents a source document from tricking michael@0: * the user into a dragging a chrome url, for example. michael@0: * - aDisallowInherit is true, and the URI being dropped would inherit the michael@0: * current document's security context (URI_INHERITS_SECURITY_CONTEXT). michael@0: * michael@0: * aName is filled in with the link title if it exists, or an empty string michael@0: * otherwise. michael@0: */ michael@0: AString dropLink(in nsIDOMDragEvent aEvent, out AString aName, michael@0: [optional] in boolean aDisallowInherit); michael@0: };