1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
8 #include
"nsITransferable.idl"
15 interface nsIContentSecurityPolicy
;
17 native nsSize
(nsSize
);
23 [scriptable
, builtinclass
, uuid(25bce737
-73f0
-43c7
-bc20
-c71044a73c5a
)]
24 interface nsIDragSession
: nsISupports
27 * Set the current state of the drag, whether it can be dropped or not.
28 * usually the target "frame" sets this so the native system can render the correct feedback
30 attribute
boolean canDrop
;
33 * Indicates if the drop event should be dispatched only to chrome.
35 attribute
boolean onlyChromeDrop
;
38 * Sets the action (copy, move, link, et.c) for the current drag
40 attribute
unsigned long dragAction
;
43 * Get the number of items that were dropped
45 readonly attribute
unsigned long numDropItems
;
48 * The document where the drag was started, which will be null if the
49 * drag originated outside the application. Useful for determining if a drop
50 * originated in the same document.
53 readonly attribute Document sourceDocument
;
56 * The dom node that was originally dragged to start the session, which will be null if the
57 * drag originated outside the application.
59 readonly attribute Node sourceNode
;
62 * the triggering principal. This may be different than sourceNode's
63 * principal when sourceNode is xul:browser and the drag is
64 * triggered in a browsing context inside it.
66 attribute nsIPrincipal triggeringPrincipal
;
69 * the triggering csp. This may be different than sourceNode's
70 * csp when sourceNode is xul:browser and the drag is
71 * triggered in a browsing context inside it.
73 attribute nsIContentSecurityPolicy csp
;
76 * The data transfer object for the current drag.
78 [binaryname
(DataTransferXPCOM
)]
79 attribute DataTransfer dataTransfer
;
80 [notxpcom
, nostdcall
] DataTransfer getDataTransfer
();
81 [notxpcom
, nostdcall
] void setDataTransfer
(in DataTransfer aDataTransfer
);
84 * Get data from a Drag&Drop. Can be called while the drag is in process
85 * or after the drop has completed.
87 * @param aTransferable the transferable for the data to be put into
88 * @param aItemIndex which of multiple drag items, zero-based
90 void getData
( in nsITransferable aTransferable
, in unsigned long aItemIndex
) ;
93 * Check to set if any of the native data on the clipboard matches this data flavor
95 boolean isDataFlavorSupported
( in string aDataFlavor
) ;
99 void dragEventDispatchedToChildProcess
();
101 // Called when nsIDragSession implementation should update the UI for the
102 // drag-and-drop based on the data got from the child process in response to
103 // NS_DRAGDROP_OVER sent from parent process to child process.
104 void updateDragEffect
();
106 // Change the drag image, using similar arguments as
107 // nsIDragService::InvokeDragSessionWithImage.
108 void updateDragImage
(in Node aImage
, in long aImageX
, in long aImageY
);
111 * Returns effects allowed at starting the session for tests.
113 [notxpcom
, nostdcall
] unsigned long getEffectAllowedForTests
();
116 * Returns true if current session was started with synthesized drag start.
118 [notxpcom
, nostdcall
] bool isSynthesizedForTests
();
121 * Sets drag end point of synthesized session when the test does not dispatch
124 void setDragEndPointForTests
(in long aScreenX
, in long aScreenY
);