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
;
19 class IPCDataTransferItem
;
23 * This class is used to hold information about a drag
24 * when a drag begins in a content process.
26 class RemoteDragStartData
{
28 NS_INLINE_DECL_REFCOUNTING(RemoteDragStartData
)
30 RemoteDragStartData(BrowserParent
* aBrowserParent
,
31 nsTArray
<IPCDataTransfer
>&& aDataTransfer
,
32 const LayoutDeviceIntRect
& aRect
,
33 nsIPrincipal
* aPrincipal
, nsIContentSecurityPolicy
* aCsp
,
34 nsICookieJarSettings
* aCookieJarSettings
);
36 void SetVisualization(
37 already_AddRefed
<gfx::DataSourceSurface
> aVisualization
) {
38 mVisualization
= aVisualization
;
41 // Get the drag image and rectangle, clearing it from this
42 // RemoteDragStartData in the process.
43 already_AddRefed
<mozilla::gfx::SourceSurface
> TakeVisualization(
44 LayoutDeviceIntRect
* aRect
) {
46 return mVisualization
.forget();
49 void AddInitialDnDDataTo(DataTransfer
* aDataTransfer
,
50 nsIPrincipal
** aPrincipal
,
51 nsIContentSecurityPolicy
** aCsp
,
52 nsICookieJarSettings
** aCookieJarSettings
);
55 virtual ~RemoteDragStartData();
57 RefPtr
<BrowserParent
> mBrowserParent
;
58 nsTArray
<IPCDataTransfer
> mDataTransfer
;
59 const LayoutDeviceIntRect mRect
;
60 nsCOMPtr
<nsIPrincipal
> mPrincipal
;
61 nsCOMPtr
<nsIContentSecurityPolicy
> mCsp
;
62 nsCOMPtr
<nsICookieJarSettings
> mCookieJarSettings
;
63 RefPtr
<mozilla::gfx::SourceSurface
> mVisualization
;
67 } // namespace mozilla
69 #endif // mozilla_dom_RemoteDragStartData_h