|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIDOMDragEvent; |
|
8 interface nsIURI; |
|
9 |
|
10 [scriptable, uuid(6B58A5A7-76D0-4E93-AB2E-4DE108683FF8)] |
|
11 interface nsIDroppedLinkHandler : nsISupports |
|
12 { |
|
13 /** |
|
14 * Determines if a link being dragged can be dropped and returns true if so. |
|
15 * aEvent should be a dragenter or dragover event. |
|
16 * |
|
17 * If aAllowSameDocument is false, drops are only allowed if the document |
|
18 * of the source of the drag is different from the destination. This check |
|
19 * includes any parent, sibling and child frames in the same content tree. |
|
20 * If true, the source is not checked. |
|
21 */ |
|
22 boolean canDropLink(in nsIDOMDragEvent aEvent, in boolean aAllowSameDocument); |
|
23 |
|
24 /** |
|
25 * Given a drop event aEvent, determines the link being dragged and returns |
|
26 * it. If a uri is returned the caller can, for instance, load it. If null |
|
27 * is returned, there is no valid link to be dropped. |
|
28 * |
|
29 * A NS_ERROR_DOM_SECURITY_ERR error will be thrown and the event cancelled if |
|
30 * the receiving target should not load the uri for security reasons. This |
|
31 * will occur if any of the following conditions are true: |
|
32 * - the source of the drag initiated a link for dragging that |
|
33 * it itself cannot access. This prevents a source document from tricking |
|
34 * the user into a dragging a chrome url, for example. |
|
35 * - aDisallowInherit is true, and the URI being dropped would inherit the |
|
36 * current document's security context (URI_INHERITS_SECURITY_CONTEXT). |
|
37 * |
|
38 * aName is filled in with the link title if it exists, or an empty string |
|
39 * otherwise. |
|
40 */ |
|
41 AString dropLink(in nsIDOMDragEvent aEvent, out AString aName, |
|
42 [optional] in boolean aDisallowInherit); |
|
43 }; |