1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsDragService_h__
7 #define nsDragService_h__
9 #include "nsBaseDragService.h"
11 #include "AndroidGraphics.h"
12 #include "mozilla/java/GeckoDragAndDropNatives.h"
14 class nsITransferable
;
16 class nsDragService final
: public nsBaseDragService
{
18 nsDragService() = default;
20 NS_DECL_ISUPPORTS_INHERITED
22 static already_AddRefed
<nsDragService
> GetInstance();
25 NS_IMETHOD
GetData(nsITransferable
* aTransferable
, uint32_t anItem
) override
;
26 NS_IMETHOD
GetNumDropItems(uint32_t* aNumItems
) override
;
27 NS_IMETHOD
IsDataFlavorSupported(const char* aDataFlavor
,
28 bool* _retval
) override
;
29 MOZ_CAN_RUN_SCRIPT NS_IMETHOD
EndDragSession(bool aDoneDrag
,
30 uint32_t aKeyModifiers
) override
;
32 UpdateDragImage(nsINode
* aImage
, int32_t aImageX
, int32_t aImageY
) override
;
33 virtual bool MustUpdateDataTransfer(mozilla::EventMessage aMessage
) override
;
35 void SetData(nsITransferable
* aTransferable
);
37 static void SetDropData(
38 mozilla::java::GeckoDragAndDrop::DropData::Param aDropData
);
41 virtual ~nsDragService() = default;
44 MOZ_CAN_RUN_SCRIPT nsresult
45 InvokeDragSessionImpl(nsIArray
* anArrayTransferables
,
46 const mozilla::Maybe
<mozilla::CSSIntRegion
>& aRegion
,
47 uint32_t aActionType
) override
;
50 mozilla::java::sdk::Bitmap::LocalRef
CreateDragImage(
51 nsINode
* aNode
, const mozilla::Maybe
<mozilla::CSSIntRegion
>& aRegion
);
53 // our source data items
54 nsCOMPtr
<nsITransferable
> mTransferable
;
57 #endif // nsDragService_h__