1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_RemoteDragStartData_h
6 #define mozilla_dom_RemoteDragStartData_h
10 #include "mozilla/dom/DataTransfer.h"
11 #include "mozilla/dom/DOMTypes.h"
12 #include "mozilla/gfx/DataSurfaceHelpers.h"
14 class nsICookieJarSettings
;
16 namespace mozilla::dom
{
18 class IPCDataTransferItem
;
22 * This class is used to hold information about a drag
23 * when a drag begins in a content process.
25 class RemoteDragStartData
{
27 NS_INLINE_DECL_REFCOUNTING(RemoteDragStartData
)
29 RemoteDragStartData(BrowserParent
* aBrowserParent
,
30 nsTArray
<IPCTransferableData
>&& aTransferableData
,
31 const LayoutDeviceIntRect
& aRect
,
32 nsIPrincipal
* aPrincipal
, nsIContentSecurityPolicy
* aCsp
,
33 nsICookieJarSettings
* aCookieJarSettings
,
34 WindowContext
* aSourceWindowContext
,
35 WindowContext
* aSourceTopWindowContext
);
37 void SetVisualization(
38 already_AddRefed
<gfx::DataSourceSurface
> aVisualization
) {
39 mVisualization
= aVisualization
;
42 // Get the drag image and rectangle, clearing it from this
43 // RemoteDragStartData in the process.
44 already_AddRefed
<mozilla::gfx::SourceSurface
> TakeVisualization(
45 LayoutDeviceIntRect
* aRect
) {
47 return mVisualization
.forget();
50 void AddInitialDnDDataTo(DataTransfer
* aDataTransfer
,
51 nsIPrincipal
** aPrincipal
,
52 nsIContentSecurityPolicy
** aCsp
,
53 nsICookieJarSettings
** aCookieJarSettings
);
55 WindowContext
* GetSourceWindowContext() { return mSourceWindowContext
; }
56 WindowContext
* GetSourceTopWindowContext() { return mSourceTopWindowContext
; }
59 virtual ~RemoteDragStartData();
61 RefPtr
<BrowserParent
> mBrowserParent
;
62 nsTArray
<IPCTransferableData
> mTransferableData
;
63 const LayoutDeviceIntRect mRect
;
64 nsCOMPtr
<nsIPrincipal
> mPrincipal
;
65 nsCOMPtr
<nsIContentSecurityPolicy
> mCsp
;
66 nsCOMPtr
<nsICookieJarSettings
> mCookieJarSettings
;
67 RefPtr
<WindowContext
> mSourceWindowContext
;
68 RefPtr
<WindowContext
> mSourceTopWindowContext
;
69 RefPtr
<mozilla::gfx::SourceSurface
> mVisualization
;
72 } // namespace mozilla::dom
74 #endif // mozilla_dom_RemoteDragStartData_h