VirtualBox

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

Last change on this file since 86115 was 85743, checked in by vboxsync, 4 years ago

DnD/Main: Don't mix rc and HRESULT in GuestDnD[Source|Target]::init() functions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: GuestDnDSourceImpl.h 85743 2020-08-13 07:36:01Z 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 HRESULT 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
61 /** Private wrapped @name IDnDSource methods.
62 * @{ */
63 HRESULT dragIsPending(ULONG uScreenId, GuestDnDMIMEList &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction);
64 HRESULT drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress);
65 HRESULT receiveData(std::vector<BYTE> &aData);
66 /** @} */
67
68protected:
69
70 void i_reset(void);
71
72#ifdef VBOX_WITH_DRAG_AND_DROP_GH
73 /** @name Dispatch handlers for the HGCM callbacks.
74 * @{ */
75 int i_onReceiveDataHdr(GuestDnDRecvCtx *pCtx, PVBOXDNDSNDDATAHDR pDataHdr);
76 int i_onReceiveData(GuestDnDRecvCtx *pCtx, PVBOXDNDSNDDATA pSndData);
77 int i_onReceiveDir(GuestDnDRecvCtx *pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode);
78 int i_onReceiveFileHdr(GuestDnDRecvCtx *pCtx, const char *pszPath, uint32_t cbPath, uint64_t cbSize, uint32_t fMode, uint32_t fFlags);
79 int i_onReceiveFileData(GuestDnDRecvCtx *pCtx,const void *pvData, uint32_t cbData);
80 /** @} */
81#endif
82
83protected:
84
85 static Utf8Str i_guestErrorToString(int guestRc);
86 static Utf8Str i_hostErrorToString(int hostRc);
87
88 /** @name Callbacks for dispatch handler.
89 * @{ */
90 static DECLCALLBACK(int) i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
91 static DECLCALLBACK(int) i_receiveTransferDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
92 /** @} */
93
94protected:
95
96 int i_receiveData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
97 int i_receiveRawData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
98 int i_receiveTransferData(GuestDnDRecvCtx *pCtx, RTMSINTERVAL msTimeout);
99
100protected:
101
102 struct
103 {
104 /** Maximum data block size (in bytes) the source can handle. */
105 uint32_t mcbBlockSize;
106 /** The context for receiving data from the guest.
107 * At the moment only one transfer at a time is supported. */
108 GuestDnDRecvCtx mRecvCtx;
109 } mData;
110
111 friend class GuestDnDRecvDataTask;
112};
113
114#endif /* !MAIN_INCLUDED_GuestDnDSourceImpl_h */
115
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