2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2013-08-12 18:45:33 +04:00
|
|
|
#ifndef mozilla_dom_DataTransfer_h
|
|
|
|
#define mozilla_dom_DataTransfer_h
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsIVariant.h"
|
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIDOMDataTransfer.h"
|
|
|
|
#include "nsIDOMElement.h"
|
2014-02-27 07:23:31 +04:00
|
|
|
#include "nsIDragService.h"
|
2008-08-27 16:07:27 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-09-02 09:08:01 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2016-11-15 20:46:32 +03:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2014-10-08 20:15:23 +04:00
|
|
|
#include "mozilla/dom/File.h"
|
2009-07-31 01:02:08 +04:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
class nsINode;
|
2008-08-27 16:07:27 +04:00
|
|
|
class nsITransferable;
|
2013-08-30 01:18:25 +04:00
|
|
|
class nsILoadContext;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2013-08-12 18:45:33 +04:00
|
|
|
namespace mozilla {
|
2014-04-01 08:09:23 +04:00
|
|
|
|
|
|
|
class EventStateManager;
|
|
|
|
|
2013-08-12 18:45:33 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2015-08-28 22:21:08 +03:00
|
|
|
class DataTransferItem;
|
|
|
|
class DataTransferItemList;
|
2013-07-09 21:54:21 +04:00
|
|
|
class DOMStringList;
|
2014-02-27 07:23:31 +04:00
|
|
|
class Element;
|
2015-07-22 19:03:07 +03:00
|
|
|
class FileList;
|
2015-04-29 23:29:34 +03:00
|
|
|
class Promise;
|
2014-02-27 07:23:31 +04:00
|
|
|
template<typename T> class Optional;
|
|
|
|
|
|
|
|
#define NS_DATATRANSFER_IID \
|
2015-08-28 22:21:08 +03:00
|
|
|
{ 0x6c5f90d1, 0xa886, 0x42c8, \
|
|
|
|
{ 0x85, 0x06, 0x10, 0xbe, 0x5c, 0x0d, 0xc6, 0x77 } }
|
2014-02-27 07:23:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class DataTransfer final : public nsIDOMDataTransfer,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsWrapperCache
|
2008-08-27 16:07:27 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-02-27 07:23:31 +04:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DATATRANSFER_IID)
|
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMDATATRANSFER
|
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DataTransfer)
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2014-04-01 08:09:23 +04:00
|
|
|
friend class mozilla::EventStateManager;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2016-04-22 16:53:20 +03:00
|
|
|
static DataTransfer* Cast(nsIDOMDataTransfer* aArg)
|
|
|
|
{
|
|
|
|
return static_cast<DataTransfer*>(aArg);
|
|
|
|
}
|
2015-10-23 02:28:14 +03:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
protected:
|
|
|
|
|
2013-03-11 19:49:48 +04:00
|
|
|
// hide the default constructor
|
2013-08-12 18:45:33 +04:00
|
|
|
DataTransfer();
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
// this constructor is used only by the Clone method to copy the fields as
|
|
|
|
// needed to a new data transfer.
|
2014-02-27 07:23:31 +04:00
|
|
|
DataTransfer(nsISupports* aParent,
|
2015-09-02 09:08:01 +03:00
|
|
|
EventMessage aEventMessage,
|
2013-08-12 18:45:33 +04:00
|
|
|
const uint32_t aEffectAllowed,
|
|
|
|
bool aCursorState,
|
|
|
|
bool aIsExternal,
|
|
|
|
bool aUserCancelled,
|
|
|
|
bool aIsCrossDomainSubFrameDrop,
|
|
|
|
int32_t aClipboardType,
|
2015-08-28 22:21:08 +03:00
|
|
|
DataTransferItemList* aItems,
|
2014-02-27 07:23:31 +04:00
|
|
|
Element* aDragImage,
|
2013-08-12 18:45:33 +04:00
|
|
|
uint32_t aDragImageX,
|
|
|
|
uint32_t aDragImageY);
|
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
~DataTransfer();
|
2011-08-22 13:14:13 +04:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
static const char sEffects[8][9];
|
|
|
|
|
|
|
|
public:
|
2013-08-12 18:45:33 +04:00
|
|
|
// Constructor for DataTransfer.
|
2013-03-11 19:49:48 +04:00
|
|
|
//
|
|
|
|
// aIsExternal must only be true when used to create a dataTransfer for a
|
|
|
|
// paste or a drag that was started without using a data transfer. The
|
|
|
|
// latter will occur when an external drag occurs, that is, a drag where the
|
|
|
|
// source is another application, or a drag is started by calling the drag
|
2013-08-07 22:52:38 +04:00
|
|
|
// service directly. For clipboard operations, aClipboardType indicates
|
2016-04-22 16:53:20 +03:00
|
|
|
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard
|
|
|
|
// operations, or if access to the system clipboard should not be allowed.
|
2015-09-02 09:08:01 +03:00
|
|
|
DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
|
|
|
bool aIsExternal, int32_t aClipboardType);
|
2014-02-27 07:23:31 +04:00
|
|
|
|
2016-04-22 16:53:20 +03:00
|
|
|
virtual JSObject*
|
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
nsISupports* GetParentObject() const
|
2014-02-27 07:23:31 +04:00
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetParentObject(nsISupports* aNewParent)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aNewParent);
|
|
|
|
// Setting the parent after we've been wrapped is pointless, so
|
|
|
|
// make sure we aren't wrapped yet.
|
|
|
|
MOZ_ASSERT(!GetWrapperPreserveColor());
|
|
|
|
mParent = aNewParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
static already_AddRefed<DataTransfer>
|
|
|
|
Constructor(const GlobalObject& aGlobal, const nsAString& aEventType,
|
|
|
|
bool aIsExternal, ErrorResult& aRv);
|
|
|
|
|
|
|
|
void GetDropEffect(nsString& aDropEffect)
|
|
|
|
{
|
|
|
|
aDropEffect.AssignASCII(sEffects[mDropEffect]);
|
|
|
|
}
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void GetEffectAllowed(nsString& aEffectAllowed)
|
|
|
|
{
|
|
|
|
if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
|
|
|
|
aEffectAllowed.AssignLiteral("uninitialized");
|
|
|
|
} else {
|
|
|
|
aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
|
|
|
|
}
|
|
|
|
}
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2016-12-24 02:09:44 +03:00
|
|
|
void SetDragImage(Element& aElement, int32_t aX, int32_t aY);
|
|
|
|
void UpdateDragImage(Element& aElement, int32_t aX, int32_t aY);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2016-11-15 20:46:32 +03:00
|
|
|
void GetTypes(nsTArray<nsString>& aTypes, CallerType aCallerType) const;
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2016-09-30 20:54:28 +03:00
|
|
|
void GetData(const nsAString& aFormat, nsAString& aData,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-30 20:54:28 +03:00
|
|
|
ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void SetData(const nsAString& aFormat, const nsAString& aData,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-27 07:23:31 +04:00
|
|
|
ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void ClearData(const mozilla::dom::Optional<nsAString>& aFormat,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-27 07:23:31 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2016-09-30 20:54:28 +03:00
|
|
|
already_AddRefed<FileList>
|
2016-10-11 04:07:48 +03:00
|
|
|
GetFiles(nsIPrincipal& aSubjectPrincipal,
|
2016-09-30 20:54:28 +03:00
|
|
|
mozilla::ErrorResult& aRv);
|
2015-07-10 20:57:23 +03:00
|
|
|
|
2016-09-30 20:54:28 +03:00
|
|
|
already_AddRefed<Promise>
|
2016-10-11 04:07:48 +03:00
|
|
|
GetFilesAndDirectories(nsIPrincipal& aSubjectPrincipal,
|
2016-09-30 20:54:28 +03:00
|
|
|
mozilla::ErrorResult& aRv);
|
2015-07-10 20:57:23 +03:00
|
|
|
|
2016-09-30 20:54:28 +03:00
|
|
|
already_AddRefed<Promise>
|
|
|
|
GetFiles(bool aRecursiveFlag,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2016-09-30 20:54:28 +03:00
|
|
|
ErrorResult& aRv);
|
2016-07-09 12:21:42 +03:00
|
|
|
|
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void AddElement(Element& aElement, mozilla::ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2015-08-28 22:21:08 +03:00
|
|
|
uint32_t MozItemCount() const;
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void GetMozCursor(nsString& aCursor)
|
|
|
|
{
|
|
|
|
if (mCursorState) {
|
|
|
|
aCursor.AssignLiteral("default");
|
|
|
|
} else {
|
|
|
|
aCursor.AssignLiteral("auto");
|
|
|
|
}
|
|
|
|
}
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2013-07-09 21:54:21 +04:00
|
|
|
already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
|
2016-11-15 20:46:32 +03:00
|
|
|
CallerType aCallerType,
|
2016-05-11 17:04:19 +03:00
|
|
|
mozilla::ErrorResult& aRv) const;
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-27 07:23:31 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void MozSetDataAt(JSContext* aCx, const nsAString& aFormat,
|
|
|
|
JS::Handle<JS::Value> aData, uint32_t aIndex,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-27 07:23:31 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void MozGetDataAt(JSContext* aCx, const nsAString& aFormat,
|
|
|
|
uint32_t aIndex, JS::MutableHandle<JS::Value> aRetval,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-06-12 00:26:52 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
|
|
|
bool MozUserCancelled() const
|
2014-02-27 07:23:31 +04:00
|
|
|
{
|
|
|
|
return mUserCancelled;
|
|
|
|
}
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
already_AddRefed<nsINode> GetMozSourceNode();
|
2013-03-11 19:49:48 +04:00
|
|
|
|
2016-04-22 16:53:20 +03:00
|
|
|
mozilla::dom::Element* GetDragTarget() const
|
2008-08-27 16:07:27 +04:00
|
|
|
{
|
2014-02-27 07:23:31 +04:00
|
|
|
return mDragTarget;
|
2008-08-27 16:07:27 +04:00
|
|
|
}
|
|
|
|
|
2015-10-23 02:28:14 +03:00
|
|
|
nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
|
|
|
|
nsIVariant** aData);
|
|
|
|
|
2016-08-18 01:39:15 +03:00
|
|
|
DataTransferItemList* Items() const {
|
|
|
|
return mItems;
|
|
|
|
}
|
|
|
|
|
2016-04-22 16:53:20 +03:00
|
|
|
// a readonly dataTransfer cannot have new data added or existing data
|
|
|
|
// removed. Only the dropEffect and effectAllowed may be modified.
|
2016-08-18 01:39:15 +03:00
|
|
|
bool IsReadOnly() const {
|
|
|
|
return mReadOnly;
|
|
|
|
}
|
|
|
|
void SetReadOnly() {
|
|
|
|
mReadOnly = true;
|
|
|
|
}
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2016-08-18 01:39:15 +03:00
|
|
|
int32_t ClipboardType() const {
|
|
|
|
return mClipboardType;
|
|
|
|
}
|
|
|
|
EventMessage GetEventMessage() const {
|
|
|
|
return mEventMessage;
|
|
|
|
}
|
|
|
|
bool IsCrossDomainSubFrameDrop() const {
|
|
|
|
return mIsCrossDomainSubFrameDrop;
|
|
|
|
}
|
2015-08-28 22:21:08 +03:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// converts the data into an array of nsITransferable objects to be used for
|
|
|
|
// drag and drop or clipboard operations.
|
2016-10-18 21:56:20 +03:00
|
|
|
already_AddRefed<nsIArray> GetTransferables(nsIDOMNode* aDragTarget);
|
2013-03-11 19:49:48 +04:00
|
|
|
|
2016-10-18 21:56:20 +03:00
|
|
|
already_AddRefed<nsIArray>
|
2016-04-22 16:53:20 +03:00
|
|
|
GetTransferables(nsILoadContext* aLoadContext);
|
|
|
|
|
|
|
|
// converts the data for a single item at aIndex into an nsITransferable
|
|
|
|
// object.
|
|
|
|
already_AddRefed<nsITransferable>
|
|
|
|
GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext);
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
// converts the data in the variant to an nsISupportString if possible or
|
|
|
|
// an nsISupports or null otherwise.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ConvertFromVariant(nsIVariant* aVariant,
|
2016-04-22 16:53:20 +03:00
|
|
|
nsISupports** aSupports,
|
|
|
|
uint32_t* aLength) const;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
// clears all of the data
|
|
|
|
void ClearAll();
|
|
|
|
|
|
|
|
// Similar to SetData except also specifies the principal to store.
|
2013-03-11 19:49:48 +04:00
|
|
|
// aData may be null when called from CacheExternalDragFormats or
|
|
|
|
// CacheExternalClipboardFormats.
|
2008-08-27 16:07:27 +04:00
|
|
|
nsresult SetDataWithPrincipal(const nsAString& aFormat,
|
|
|
|
nsIVariant* aData,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aIndex,
|
2008-08-27 16:07:27 +04:00
|
|
|
nsIPrincipal* aPrincipal);
|
|
|
|
|
2016-04-21 21:11:14 +03:00
|
|
|
// Variation of SetDataWithPrincipal with handles extracting
|
|
|
|
// kCustomTypesMime data into separate types.
|
|
|
|
void SetDataWithPrincipalFromOtherProcess(const nsAString& aFormat,
|
|
|
|
nsIVariant* aData,
|
|
|
|
uint32_t aIndex,
|
2016-06-21 20:07:17 +03:00
|
|
|
nsIPrincipal* aPrincipal,
|
|
|
|
bool aHidden);
|
2016-04-21 21:11:14 +03:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// returns a weak reference to the drag image
|
2016-04-22 16:53:20 +03:00
|
|
|
Element* GetDragImage(int32_t* aX, int32_t* aY) const
|
2008-08-27 16:07:27 +04:00
|
|
|
{
|
|
|
|
*aX = mDragImageX;
|
|
|
|
*aY = mDragImageY;
|
|
|
|
return mDragImage;
|
|
|
|
}
|
|
|
|
|
2015-09-02 09:08:01 +03:00
|
|
|
nsresult Clone(nsISupports* aParent, EventMessage aEventMessage,
|
|
|
|
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
|
|
|
|
DataTransfer** aResult);
|
2014-02-27 07:23:31 +04:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// converts some formats used for compatibility in aInFormat into aOutFormat.
|
|
|
|
// Text and text/unicode become text/plain, and URL becomes text/uri-list
|
2016-04-22 16:53:20 +03:00
|
|
|
void GetRealFormat(const nsAString& aInFormat, nsAString& aOutFormat) const;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2016-08-23 18:29:48 +03:00
|
|
|
static bool PrincipalMaySetData(const nsAString& aFormat,
|
|
|
|
nsIVariant* aData,
|
|
|
|
nsIPrincipal* aPrincipal);
|
|
|
|
|
2016-10-11 04:07:47 +03:00
|
|
|
// Notify the DataTransfer that the list returned from GetTypes may have
|
|
|
|
// changed. This can happen due to items we care about for purposes of
|
|
|
|
// GetTypes being added or removed or changing item kinds.
|
|
|
|
void TypesListMayHaveChanged();
|
|
|
|
|
2015-08-28 22:21:08 +03:00
|
|
|
protected:
|
|
|
|
|
2013-03-11 19:49:48 +04:00
|
|
|
// caches text and uri-list data formats that exist in the drag service or
|
|
|
|
// clipboard for retrieval later.
|
2016-05-31 22:03:44 +03:00
|
|
|
nsresult CacheExternalData(const char* aFormat, uint32_t aIndex,
|
|
|
|
nsIPrincipal* aPrincipal, bool aHidden);
|
2013-03-11 19:49:48 +04:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// caches the formats that exist in the drag service that were added by an
|
|
|
|
// external drag
|
2013-03-11 19:49:48 +04:00
|
|
|
void CacheExternalDragFormats();
|
|
|
|
|
|
|
|
// caches the formats that exist in the clipboard
|
|
|
|
void CacheExternalClipboardFormats();
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2015-08-28 22:21:08 +03:00
|
|
|
FileList* GetFilesInternal(ErrorResult& aRv, nsIPrincipal* aSubjectPrincipal);
|
2015-10-23 02:28:14 +03:00
|
|
|
nsresult GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex,
|
2016-04-22 16:53:20 +03:00
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
|
|
|
nsIVariant** aData);
|
|
|
|
|
|
|
|
nsresult SetDataAtInternal(const nsAString& aFormat, nsIVariant* aData,
|
|
|
|
uint32_t aIndex, nsIPrincipal* aSubjectPrincipal);
|
2015-10-23 01:30:04 +03:00
|
|
|
|
2015-04-08 21:48:11 +03:00
|
|
|
friend class ContentParent;
|
2016-04-22 16:53:20 +03:00
|
|
|
|
2015-04-08 21:48:11 +03:00
|
|
|
void FillAllExternalData();
|
|
|
|
|
2016-04-21 21:11:14 +03:00
|
|
|
void FillInExternalCustomTypes(uint32_t aIndex, nsIPrincipal* aPrincipal);
|
2016-04-22 16:53:20 +03:00
|
|
|
|
|
|
|
void FillInExternalCustomTypes(nsIVariant* aData, uint32_t aIndex,
|
|
|
|
nsIPrincipal* aPrincipal);
|
2016-04-21 21:11:14 +03:00
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
void MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
|
2016-10-11 04:07:48 +03:00
|
|
|
nsIPrincipal& aSubjectPrincipal,
|
2014-02-27 07:23:31 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// the drop effect and effect allowed
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mDropEffect;
|
|
|
|
uint32_t mEffectAllowed;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2015-09-02 09:08:01 +03:00
|
|
|
// the event message this data transfer is for. This will correspond to an
|
|
|
|
// event->mMessage value.
|
|
|
|
EventMessage mEventMessage;
|
|
|
|
|
2009-03-06 20:54:29 +03:00
|
|
|
// Indicates the behavior of the cursor during drag operations
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCursorState;
|
2009-03-06 20:54:29 +03:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// readonly data transfers may not be modified except the drop effect and
|
|
|
|
// effect allowed.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mReadOnly;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
// true for drags started without a data transfer, for example, those from
|
|
|
|
// another application.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsExternal;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
2009-02-17 18:51:12 +03:00
|
|
|
// true if the user cancelled the drag. Used only for the dragend event.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mUserCancelled;
|
2009-02-17 18:51:12 +03:00
|
|
|
|
2012-03-20 19:21:41 +04:00
|
|
|
// true if this is a cross-domain drop from a subframe where access to the
|
|
|
|
// data should be prevented
|
|
|
|
bool mIsCrossDomainSubFrameDrop;
|
|
|
|
|
2013-08-07 22:52:38 +04:00
|
|
|
// Indicates which clipboard type to use for clipboard operations. Ignored for
|
|
|
|
// drag and drop.
|
|
|
|
int32_t mClipboardType;
|
|
|
|
|
2015-08-28 22:21:08 +03:00
|
|
|
// The items contained with the DataTransfer
|
|
|
|
RefPtr<DataTransferItemList> mItems;
|
2009-07-31 01:02:08 +04:00
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
// the target of the drag. The drag and dragend events will fire at this.
|
2014-02-27 07:23:31 +04:00
|
|
|
nsCOMPtr<mozilla::dom::Element> mDragTarget;
|
2008-08-27 16:07:27 +04:00
|
|
|
|
|
|
|
// the custom drag image and coordinates within the image. If mDragImage is
|
|
|
|
// null, the default image is created from the drag target.
|
2014-02-27 07:23:31 +04:00
|
|
|
nsCOMPtr<mozilla::dom::Element> mDragImage;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mDragImageX;
|
|
|
|
uint32_t mDragImageY;
|
2008-08-27 16:07:27 +04:00
|
|
|
};
|
|
|
|
|
2014-02-27 07:23:31 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(DataTransfer, NS_DATATRANSFER_IID)
|
|
|
|
|
2013-08-12 18:45:33 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_DataTransfer_h */
|