VirtualBox

source: vbox/trunk/src/VBox/Main/include/GuestDnDSourceImpl.h@ 85582

Last change on this file since 85582 was 85537, checked in by vboxsync, 4 years ago

DnD/Main: More fixes and cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: GuestDnDSourceImpl.h 85537 2020-07-30 06:55:32Z vboxsync $ */
2/** @file
3 * VBox Console COM Class implementation - Guest drag'n drop source.
4 */
5
6/*
7 * Copyright (C) 2014-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_GuestDnDSourceImpl_h
19#define MAIN_INCLUDED_GuestDnDSourceImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/GuestHost/DragAndDrop.h>
25#include <VBox/HostServices/DragAndDropSvc.h>
26
27using namespace DragAndDropSvc;
28
29#include "GuestDnDSourceWrap.h"
30#include "GuestDnDPrivate.h"
31
32class GuestDnDRecvDataTask;
33struct GuestDnDRecvCtx;
34
35class ATL_NO_VTABLE GuestDnDSource :
36 public GuestDnDSourceWrap,
37 public GuestDnDBase
38{
39public:
40 /** @name COM and internal init/term/mapping cruft.
41 * @{ */
42 DECLARE_EMPTY_CTOR_DTOR(GuestDnDSource)
43
44 int init(const ComObjPtr<Guest>& pGuest);
45 void uninit(void);
46
47 HRESULT FinalConstruct(void);
48 void FinalRelease(void);
49 /** @} */
50
51private:
52
53 /** Private wrapped @name IDnDBase methods.
54 * @{ */
55 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
56 HRESULT getFormats(GuestDnDMIMEList &aFormats);
57 HRESULT addFormats(const GuestDnDMIMEList &aFormats);
58 HRESULT removeFormats(const GuestDnDMIMEList &aFormats);
59
60 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
61 /** @} */
62
63 /** Private wrapped @name IDnDSource methods.
64 * @{ */
65 HRESULT dragIsPending(ULONG uScreenId, GuestDnDMIMEList &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction);
66 HRESULT drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress);
67 HRESULT receiveData(std::vector<BYTE> &aData);
68 /** @} */
69
70protected:
71
72 void i_reset(void);
73
74#ifdef VBOX_WITH_DRAG_AND_DROP_GH
75 /** @name Dispatch handlers for the HGCM callbacks.
76 * @{ */
77 int i_onReceiveDataHdr(GuestDnDRecvCtx *pCtx, PVBOXDNDSNDDATAHDR pDataHdr);
78 int i_onReceiveData(GuestDnDRecvCtx *pCtx, PVBOXDNDSNDDATA pSndData);
79 int i_onReceiveDir(GuestDnDRecvCtx *pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode);
80 int i_onReceiveFileHdr(GuestDnDRecvCtx *pCtx, const char *pszPath, uint32_t cbPath, uint64_t cbSize, uint32_t fMode, uint32_t fFlags);
81 int i_onReceiveFileData(GuestDnDRecvCtx *pCtx,const void *pvData, uint32_t cbData);
82 /** @} */
83#endif
84
85protected:
86
87 static Utf8Str i_guestErrorToString(int guestRc);
88 static Utf8Str i_hostErrorToString(int hostRc);
89
90 /** @name Callbacks for dispatch handler.
91 * @{ */
92 static DECLCALLBACK(int) i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
93 static DECLCALLBACK(int) i_receiveTransferDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
94 /** @} */
95
96protected:
97
98 int i_receiveData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
99 int i_receiveRawData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
100 int i_receiveTransferData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
101
102protected:
103
104 struct
105 {
106 /** Maximum data block size (in bytes) the source can handle. */
107 uint32_t mcbBlockSize;
108 /** The context for receiving data from the guest.
109 * At the moment only one transfer at a time is supported. */
110 GuestDnDRecvCtx mRecvCtx;
111 } mData;
112
113 friend class GuestDnDRecvDataTask;
114};
115
116#endif /* !MAIN_INCLUDED_GuestDnDSourceImpl_h */
117
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette