Bug 1942006 - Upstream a variety of Servo-specific code from Servo's downstream fork...
[gecko.git] / widget / nsDragServiceProxy.h
blob3db978a1317b1b92162ff8caf317cbb9bbefd1a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef NSDRAGSERVICEPROXY_H
7 #define NSDRAGSERVICEPROXY_H
9 #include "nsBaseDragService.h"
11 class nsDragSessionProxy : public nsBaseDragSession {
12 public:
13 NS_INLINE_DECL_REFCOUNTING_INHERITED(nsDragSessionProxy, nsBaseDragSession)
15 MOZ_CAN_RUN_SCRIPT virtual nsresult InvokeDragSession(
16 nsIWidget* aWidget, nsINode* aDOMNode, nsIPrincipal* aPrincipal,
17 nsIContentSecurityPolicy* aCsp, nsICookieJarSettings* aCookieJarSettings,
18 nsIArray* aTransferableArray, uint32_t aActionType,
19 nsContentPolicyType aContentPolicyType) override;
21 nsresult InvokeDragSessionImpl(
22 nsIWidget* aWidget, nsIArray* anArrayTransferables,
23 const mozilla::Maybe<mozilla::CSSIntRegion>& aRegion,
24 uint32_t aActionType) override;
26 void SetDragTarget(mozilla::dom::BrowserChild* aTarget);
28 MOZ_CAN_RUN_SCRIPT
29 nsresult EndDragSessionImpl(bool aDoneDrag, uint32_t aKeyModifiers) override;
31 private:
32 ~nsDragSessionProxy();
34 // The source for this drag. This is null if the source is a different
35 // application or drag session.
36 nsWeakPtr mSourceBrowser;
37 // The target for this drag. This is null if the target is a different
38 // application or drag session.
39 nsWeakPtr mTargetBrowser;
42 class nsDragServiceProxy : public nsBaseDragService {
43 public:
44 NS_INLINE_DECL_REFCOUNTING_INHERITED(nsDragServiceProxy, nsBaseDragService)
46 already_AddRefed<nsIDragSession> CreateDragSession() override;
48 nsIDragSession* StartDragSession(nsISupports* aWidgetProvider) override;
50 NS_IMETHOD GetCurrentSession(nsISupports* aWidgetProvider,
51 nsIDragSession** aSession) override;
53 private:
54 virtual ~nsDragServiceProxy();
57 #endif // NSDRAGSERVICEPROXY_H