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
"nsIArray.idl"
8 #include
"nsISupports.idl"
9 #include
"nsIDragSession.idl"
10 #include
"nsIContentPolicy.idl"
17 #include
"mozilla/EventForwards.h"
23 class RemoteDragStartData
;
25 } // namespace mozilla
28 [ptr] native ContentParentPtr
(mozilla
::dom
::ContentParent
);
29 [ptr] native DataTransferPtr
(mozilla
::dom
::DataTransfer
);
30 [ptr] native RemoteDragStartDataPtr
(mozilla
::dom
::RemoteDragStartData
);
31 native EventMessage
(mozilla
::EventMessage
);
33 [scriptable
, uuid(ebd6b3a2
-af16
-43af
-a698
-3091a087dd62
), builtinclass
]
34 interface nsIDragService
: nsISupports
36 const long DRAGDROP_ACTION_NONE
= 0;
37 const long DRAGDROP_ACTION_COPY
= 1;
38 const long DRAGDROP_ACTION_MOVE
= 2;
39 const long DRAGDROP_ACTION_LINK
= 4;
40 const long DRAGDROP_ACTION_UNINITIALIZED
= 64;
43 * Starts a modal drag session with an array of transaferables.
45 * Note: This method is deprecated for non-native code.
47 * @param aPrincipal - the triggering principal of the drag, or null if
48 * it's from browser chrome or OS
49 * @param aTransferables - an array of transferables to be dragged
50 * @param aActionType - specified which of copy/move/link are allowed
51 * @param aContentPolicyType - the contentPolicyType that will be
52 * passed to the loadInfo when creating a new channel
53 * (defaults to TYPE_OTHER)
56 void invokeDragSession
(in Node aDOMNode
,
57 in nsIPrincipal aPrincipal
,
58 in nsIArray aTransferables
,
59 in unsigned long aActionType
,
60 [optional] in nsContentPolicyType aContentPolicyType
);
63 * Starts a modal drag session using an image. The first four arguments are
64 * the same as invokeDragSession.
66 * Note: This method is deprecated for non-native code.
68 * A custom image may be specified using the aImage argument. If this is
69 * supplied, the aImageX and aImageY arguments specify the offset within
70 * the image where the cursor would be positioned. That is, when the image
71 * is drawn, it is offset up and left the amount so that the cursor appears
72 * at that location within the image.
74 * If aImage is null, aImageX and aImageY are not used and the image is instead
75 * determined from the source node aDOMNode, and the offset calculated so that
76 * the initial location for the image appears in the same screen position as
77 * where the element is located. The node must be within a document.
79 * Currently, supported images are all DOM nodes. If this is an HTML <image> or
80 * <canvas>, the drag image is taken from the image data. If the element is in
81 * a document, it will be rendered at its displayed size, othewise, it will be
82 * rendered at its real size. For other types of elements, the element is
83 * rendered into an offscreen buffer in the same manner as it is currently
84 * displayed. The document selection is hidden while drawing.
86 * The aDragEvent must be supplied as the current screen coordinates of the
87 * event are needed to calculate the image location.
89 [noscript
, can_run_script
]
90 void invokeDragSessionWithImage
(in Node aDOMNode
,
91 in nsIPrincipal aPrincipal
,
92 in nsIArray aTransferableArray
,
93 in unsigned long aActionType
,
97 in DragEvent aDragEvent
,
98 in DataTransferPtr aDataTransfer
);
100 /** Start a drag session with the data in aDragStartData from a child process.
101 * Other arguments are the same as invokeDragSessionWithImage.
103 [noscript
, can_run_script
]
104 void invokeDragSessionWithRemoteImage
(in Node aDOMNode
,
105 in nsIPrincipal aPrincipal
,
106 in nsIArray aTransferableArray
,
107 in unsigned long aActionType
,
108 in RemoteDragStartDataPtr aDragStartData
,
109 in DragEvent aDragEvent
,
110 in DataTransferPtr aDataTransfer
);
113 * Start a modal drag session using the selection as the drag image.
114 * The aDragEvent must be supplied as the current screen coordinates of the
115 * event are needed to calculate the image location.
117 * Note: This method is deprecated for non-native code.
120 void invokeDragSessionWithSelection
(in Selection aSelection
,
121 in nsIPrincipal aPrincipal
,
122 in nsIArray aTransferableArray
,
123 in unsigned long aActionType
,
124 in DragEvent aDragEvent
,
125 in DataTransferPtr aDataTransfer
);
128 * Returns the current Drag Session
130 nsIDragSession getCurrentSession
();
133 * Tells the Drag Service to start a drag session. This is called when
134 * an external drag occurs
136 void startDragSession
( ) ;
139 * Tells the Drag Service to end a drag session. This is called when
140 * an external drag occurs
142 * If aDoneDrag is true, the drag has finished, otherwise the drag has
143 * just left the window.
146 void endDragSession
(in boolean aDoneDrag
,
147 [optional] in unsigned long aKeyModifiers
);
150 * Fire a drag event at the source of the drag
152 [noscript
, can_run_script
]
153 void fireDragEventAtSource
(in EventMessage aEventMessage
,
154 in unsigned long aKeyModifiers
);
157 * Increase/decrease dragging suppress level by one.
158 * If level is greater than one, dragging is disabled.
165 * aX and aY are in LayoutDevice pixels.
167 [noscript
] void dragMoved
(in long aX
, in long aY
);
169 [notxpcom
, nostdcall
] boolean maybeAddChildProcess
(in ContentParentPtr aChild
);