VirtualBox

source: vbox/trunk/src/VBox/Main/include/GuestDnDTargetImpl.h@ 85402

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

DnD/Main: Renaming; use size_t where appropriate.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: GuestDnDTargetImpl.h 85402 2020-07-21 15:10:32Z vboxsync $ */
2/** @file
3 * VBox Console COM Class implementation - Guest drag'n drop target.
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_GuestDnDTargetImpl_h
19#define MAIN_INCLUDED_GuestDnDTargetImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "GuestDnDTargetWrap.h"
25#include "GuestDnDPrivate.h"
26
27#include <VBox/GuestHost/DragAndDrop.h>
28#include <VBox/HostServices/DragAndDropSvc.h>
29
30struct GuestDnDSendCtx;
31class GuestDnDSendDataTask;
32
33class ATL_NO_VTABLE GuestDnDTarget :
34 public GuestDnDTargetWrap,
35 public GuestDnDBase
36{
37public:
38 /** @name COM and internal init/term/mapping cruft.
39 * @{ */
40 DECLARE_EMPTY_CTOR_DTOR(GuestDnDTarget)
41
42 int init(const ComObjPtr<Guest>& pGuest);
43 void uninit(void);
44
45 HRESULT FinalConstruct(void);
46 void FinalRelease(void);
47 /** @} */
48
49private:
50
51 /** Private wrapped @name IDnDBase methods.
52 * @{ */
53 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
54 HRESULT getFormats(GuestDnDMIMEList &aFormats);
55 HRESULT addFormats(const GuestDnDMIMEList &aFormats);
56 HRESULT removeFormats(const GuestDnDMIMEList &aFormats);
57
58 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
59 /** @} */
60
61 /** Private wrapped @name IDnDTarget methods.
62 * @{ */
63 HRESULT enter(ULONG aScreenId, ULONG ax, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction);
64 HRESULT move(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction);
65 HRESULT leave(ULONG aScreenId);
66 HRESULT drop(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, com::Utf8Str &aFormat, DnDAction_T *aResultAction);
67 HRESULT sendData(ULONG aScreenId, const com::Utf8Str &aFormat, const std::vector<BYTE> &aData, ComPtr<IProgress> &aProgress);
68 HRESULT cancel(BOOL *aVeto);
69 /** @} */
70
71protected:
72
73 static Utf8Str i_guestErrorToString(int guestRc);
74 static Utf8Str i_hostErrorToString(int hostRc);
75
76 /** @name Thread task workers.
77 * @{ */
78 static void i_sendDataThreadTask(GuestDnDSendDataTask *pTask);
79 /** @} */
80
81 /** @name Callbacks for dispatch handler.
82 * @{ */
83 static DECLCALLBACK(int) i_sendTransferDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
84 /** @} */
85
86protected:
87
88 int i_sendData(GuestDnDSendCtx *pCtx, RTMSINTERVAL msTimeout);
89
90 int i_sendMetaDataBody(GuestDnDSendCtx *pCtx);
91 int i_sendMetaDataHeader(GuestDnDSendCtx *pCtx);
92
93 int i_sendTransferData(GuestDnDSendCtx *pCtx, RTMSINTERVAL msTimeout);
94 int i_sendTransferDataLoop(GuestDnDSendCtx *pCtx, GuestDnDMsg *pMsg);
95
96 int i_sendDirectory(GuestDnDSendCtx *pCtx, PDNDTRANSFEROBJECT pObj, GuestDnDMsg *pMsg);
97 int i_sendFile(GuestDnDSendCtx *pCtx, PDNDTRANSFEROBJECT pObj, GuestDnDMsg *pMsg);
98 int i_sendFileData(GuestDnDSendCtx *pCtx, PDNDTRANSFEROBJECT pObj, GuestDnDMsg *pMsg);
99
100 int i_sendRawData(GuestDnDSendCtx *pCtx, RTMSINTERVAL msTimeout);
101
102protected:
103
104 struct
105 {
106 /** Flag indicating whether a data transfer currently is active. */
107 bool mfTransferIsPending;
108 /** Maximum data block size (in bytes) the target can handle. */
109 uint32_t mcbBlockSize;
110 } mData;
111
112 friend class GuestDnDSendDataTask;
113};
114
115#endif /* !MAIN_INCLUDED_GuestDnDTargetImpl_h */
116
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