Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / RemoteDragStartData.h
blob7f1fb54488fcd44d0e49f235ba39b6adf4e26f92
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
8 #include "nsCOMPtr.h"
9 #include "nsRect.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;
19 class BrowserParent;
21 /**
22 * This class is used to hold information about a drag
23 * when a drag begins in a content process.
25 class RemoteDragStartData {
26 public:
27 NS_INLINE_DECL_REFCOUNTING(RemoteDragStartData)
29 RemoteDragStartData(BrowserParent* aBrowserParent,
30 nsTArray<IPCDataTransfer>&& aDataTransfer,
31 const LayoutDeviceIntRect& aRect,
32 nsIPrincipal* aPrincipal, nsIContentSecurityPolicy* aCsp,
33 nsICookieJarSettings* aCookieJarSettings,
34 WindowContext* aSourceWindowContext);
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) {
45 *aRect = mRect;
46 return mVisualization.forget();
49 void AddInitialDnDDataTo(DataTransfer* aDataTransfer,
50 nsIPrincipal** aPrincipal,
51 nsIContentSecurityPolicy** aCsp,
52 nsICookieJarSettings** aCookieJarSettings);
54 WindowContext* GetSourceWindowContext() { return mSourceWindowContext; }
56 private:
57 virtual ~RemoteDragStartData();
59 RefPtr<BrowserParent> mBrowserParent;
60 nsTArray<IPCDataTransfer> mDataTransfer;
61 const LayoutDeviceIntRect mRect;
62 nsCOMPtr<nsIPrincipal> mPrincipal;
63 nsCOMPtr<nsIContentSecurityPolicy> mCsp;
64 nsCOMPtr<nsICookieJarSettings> mCookieJarSettings;
65 RefPtr<WindowContext> mSourceWindowContext;
66 RefPtr<mozilla::gfx::SourceSurface> mVisualization;
69 } // namespace mozilla::dom
71 #endif // mozilla_dom_RemoteDragStartData_h