1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsITransferable.idl"
%{ C++
#include "mozilla/EventForwards.h"
#include "nsIWidget.h"
#include "nsSize.h"
#include "Units.h"
class nsIFrame;
class nsIWidget;
namespace mozilla {
namespace dom {
class BrowserParent;
} // namespace dom
} // namespace mozilla
%}
interface nsIPolicyContainer;
interface nsIFile;
[ptr] native BrowserParentPtr(mozilla::dom::BrowserParent);
native EventMessage(mozilla::EventMessage);
[ref] native LayoutDeviceIntPoint(mozilla::LayoutDeviceIntPoint);
[ptr] native nsIFramePtr(nsIFrame);
[ptr] native nsIWidgetPtr(nsIWidget);
[ref] native StringSet(const nsTHashSet<nsString>);
native nsSize(nsSize);
webidl DataTransfer;
webidl DragEvent;
webidl Element;
webidl WindowContext;
webidl Node;
webidl Selection;
[scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
interface nsIDragSession : nsISupports
{
/**
* Set the current state of the drag, whether it can be dropped or not.
* usually the target "frame" sets this so the native system can render the correct feedback
*/
attribute boolean canDrop;
/**
* Indicates if the drop event should be dispatched only to chrome.
*/
attribute boolean onlyChromeDrop;
/**
* Sets the action (copy, move, link, et.c) for the current drag
*/
attribute unsigned long dragAction;
/**
* Get the number of items that were dropped
*/
readonly attribute unsigned long numDropItems;
/**
* The window context where the drag was started, which will be null if the
* drag originated outside the application. Useful for determining if a drop
* originated in the same window context.
*/
[infallible]
attribute WindowContext sourceWindowContext;
/**
* The top-level window context where the drag was started, which will be
* null if the drag originated outside the application. Useful for
* determining if a drop originated in the same top-level window context.
*/
[infallible]
attribute WindowContext sourceTopWindowContext;
/**
* The dom node that was originally dragged to start the session, which will be null if the
* drag originated outside the application.
*/
readonly attribute Node sourceNode;
/**
* Replace source node and selection with new ones.
* If sourceNode is a native anonymous node, it may be replaced at reframing.
* If sourceNode is disconnected from the document, we cannot dispatch
* `dragend` event properly.
* When this is called, sourceNode or aNewSourceNode should be a native
* anonymous node.
*/
[notxpcom, nostdcall] void updateSource(in Node aNewSourceNode,
in Selection aNewSelection);
/**
* the triggering principal. This may be different than sourceNode's
* principal when sourceNode is xul:browser and the drag is
* triggered in a browsing context inside it.
*/
attribute nsIPrincipal triggeringPrincipal;
/**
* the triggering policyContainer. This may be different than sourceNode's
* policyContainer when sourceNode is xul:browser and the drag is
* triggered in a browsing context inside it.
*/
attribute nsIPolicyContainer policyContainer;
/**
* The data transfer object for the current drag.
*/
[binaryname(DataTransferXPCOM)]
attribute DataTransfer dataTransfer;
[notxpcom, nostdcall] DataTransfer getDataTransfer();
[notxpcom, nostdcall] void setDataTransfer(in DataTransfer aDataTransfer);
/**
* Get data from a Drag&Drop. Can be called while the drag is in process
* or after the drop has completed.
*
* @param aTransferable the transferable for the data to be put into
* @param aItemIndex which of multiple drag items, zero-based
*/
void getData ( in nsITransferable aTransferable, in unsigned long aItemIndex ) ;
/**
* Check to set if any of the native data on the clipboard matches this data flavor
*/
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
void userCancelled();
void dragEventDispatchedToChildProcess();
// Called when nsIDragSession implementation should update the UI for the
// drag-and-drop based on the data got from the child process in response to
// NS_DRAGDROP_OVER sent from parent process to child process.
void updateDragEffect();
// Change the drag image, using similar arguments as
// nsIDragService::InvokeDragSessionWithImage.
void updateDragImage(in Node aImage, in long aImageX, in long aImageY);
/**
* Tell Gecko that this session is generated for automated testing.
* This should be called immediately after StartDragSession when testing.
*/
[noscript] void InitForTests(in uint32_t aAllowedEffect);
/**
* Returns effects allowed at starting the session for tests.
*/
[notxpcom, nostdcall] unsigned long getEffectAllowedForTests();
/**
* Returns true if current session was started with synthesized drag start.
*/
[notxpcom, nostdcall] boolean isSynthesizedForTests();
/**
* Sets the drag end point. Position is relative to screen in device coords.
*/
void setDragEndPoint(in long aScreenX, in long aScreenY);
/**
* Sets drag end point of synthesized session when the test does not dispatch
* "drop" event. Position is relative to screen in CSS coordinates.
*/
void setDragEndPointForTests(in float aScreenX, in float aScreenY);
/**
* Returns true if the session is for dragging text in a text in text control
* element.
*/
[notxpcom, nostdcall] boolean isDraggingTextInTextControl();
/**
* Called when HTMLEditor maybe deleted the source node from the document.
*
* @param aEditingHost The editing host when the editor deletes selection.
*/
[noscript] void maybeEditorDeletedSourceNode(in Element aEditingHost);
/**
* Sets the position for the Gecko-drawn dragged-contents image.
* aX and aY are in LayoutDevice pixels.
*/
[noscript] void dragMoved(in long aX, in long aY);
/**
* Fire a drag event at the source of the drag
*/
[noscript, can_run_script]
void fireDragEventAtSource(in EventMessage aEventMessage,
in unsigned long aKeyModifiers);
[notxpcom, nostdcall] boolean maybeAddBrowser(in BrowserParentPtr aBP);
[notxpcom, nostdcall] boolean removeAllBrowsers();
/**
* Tells the Drag Service to end a drag session.
*
* If aDoneDrag is true, the drag has finished, otherwise the drag has
* just left the window.
*
* @param aDoneDrag If true, reports the drag as complete.
* @param aKeyModifiers Key state to assume while ending the session.
*/
[can_run_script]
void endDragSession(in boolean aDoneDrag,
[optional] in unsigned long aKeyModifiers);
/**
* Tell the drag session for the given browser that it
* should store the would-be target of the aEvent (a drop event) and delay
* calls to EndDragSession. This is used in the main process.
*
* @param aEvent The drag event
*/
void sendStoreDropTargetAndDelayEndDragSession(
in DragEvent aEvent);
/**
* After sendStoreDropTargetAndDelayEndDragSession, send a drop (if
* aShouldDrop is true) or dragexit event to the recorded drop target and
* then reissue any stored EndDragSession call. This is used in the main
* process.
*
* @param aShouldDrop True to send drop event, false to send dragexit event
*/
void sendDispatchToDropTargetAndResumeEndDragSession(
in boolean aShouldDrop, in Array<nsIFile> aAllowedFiles);
/**
* Store aElement and aDocFrame as the future drop/dragexit context, and
* delay calls to EndDragSession. This is used in content processes.
*
* @param aElement The element to drop onto
* @param aDocFrame The frame to dispatch to
*/
[noscript] void storeDropTargetAndDelayEndDragSession(
in Element aElement,
in nsIFramePtr aDocFrame
);
/**
* Issue drop or dragexit to the stored drop target (if any) and issue
* any delayed call to EndDragSession. This is used in content processes.
*
* @param aWidget The widget on which the drop will happen
* @param aPt Screen coords of drop
* @param aShouldDrop If true, send a drop event. Otherwise send dragexit.
* @param aAllowedFilePaths Paths to the files that were allowed to be dropped.
*/
[noscript, can_run_script]
void dispatchToDropTargetAndResumeEndDragSession(
in nsIWidgetPtr aWidget,
[const] in LayoutDeviceIntPoint aPt,
in boolean aShouldDrop,
in StringSet aAllowedFilePaths);
/**
* Retrun true if nsIDragSession's data is updated.
*/
[notxpcom, nostdcall] boolean mustUpdateDataTransfer(in EventMessage aMessage);
};
|