1 | /* $Id: GuestDnDTargetImpl.h 76891 2019-01-18 13:17:20Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Console COM Class implementation - Guest drag'n drop target.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2019 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 |
|
---|
30 | struct SENDDATACTX;
|
---|
31 | typedef struct SENDDATACTX *PSENDDATACTX;
|
---|
32 | class SendDataTask;
|
---|
33 |
|
---|
34 | class ATL_NO_VTABLE GuestDnDTarget :
|
---|
35 | public GuestDnDTargetWrap,
|
---|
36 | public GuestDnDBase
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | /** @name COM and internal init/term/mapping cruft.
|
---|
40 | * @{ */
|
---|
41 | DECLARE_EMPTY_CTOR_DTOR(GuestDnDTarget)
|
---|
42 |
|
---|
43 | int init(const ComObjPtr<Guest>& pGuest);
|
---|
44 | void uninit(void);
|
---|
45 |
|
---|
46 | HRESULT FinalConstruct(void);
|
---|
47 | void FinalRelease(void);
|
---|
48 | /** @} */
|
---|
49 |
|
---|
50 | private:
|
---|
51 |
|
---|
52 | /** Private wrapped @name IDnDBase methods.
|
---|
53 | * @{ */
|
---|
54 | HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
|
---|
55 | HRESULT getFormats(GuestDnDMIMEList &aFormats);
|
---|
56 | HRESULT addFormats(const GuestDnDMIMEList &aFormats);
|
---|
57 | HRESULT removeFormats(const GuestDnDMIMEList &aFormats);
|
---|
58 |
|
---|
59 | HRESULT getProtocolVersion(ULONG *aProtocolVersion);
|
---|
60 | /** @} */
|
---|
61 |
|
---|
62 | /** Private wrapped @name IDnDTarget methods.
|
---|
63 | * @{ */
|
---|
64 | HRESULT enter(ULONG aScreenId, ULONG ax, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction);
|
---|
65 | HRESULT move(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const GuestDnDMIMEList &aFormats, DnDAction_T *aResultAction);
|
---|
66 | HRESULT leave(ULONG aScreenId);
|
---|
67 | 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);
|
---|
68 | HRESULT sendData(ULONG aScreenId, const com::Utf8Str &aFormat, const std::vector<BYTE> &aData, ComPtr<IProgress> &aProgress);
|
---|
69 | HRESULT cancel(BOOL *aVeto);
|
---|
70 | /** @} */
|
---|
71 |
|
---|
72 | protected:
|
---|
73 |
|
---|
74 | static Utf8Str i_guestErrorToString(int guestRc);
|
---|
75 | static Utf8Str i_hostErrorToString(int hostRc);
|
---|
76 |
|
---|
77 | /** @name Thread task workers.
|
---|
78 | * @{ */
|
---|
79 | static void i_sendDataThreadTask(SendDataTask *pTask);
|
---|
80 | /** @} */
|
---|
81 |
|
---|
82 | /** @name Callbacks for dispatch handler.
|
---|
83 | * @{ */
|
---|
84 | static DECLCALLBACK(int) i_sendURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
|
---|
85 | /** @} */
|
---|
86 |
|
---|
87 | protected:
|
---|
88 |
|
---|
89 | int i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
|
---|
90 | int i_sendDataBody(PSENDDATACTX pCtx, GuestDnDData *pData);
|
---|
91 | int i_sendDataHeader(PSENDDATACTX pCtx, GuestDnDData *pData, GuestDnDURIData *pURIData /* = NULL */);
|
---|
92 | int i_sendDirectory(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg);
|
---|
93 | int i_sendFile(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg);
|
---|
94 | int i_sendFileData(PSENDDATACTX pCtx, GuestDnDURIObjCtx *pObjCtx, GuestDnDMsg *pMsg);
|
---|
95 | int i_sendRawData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
|
---|
96 | int i_sendURIData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
|
---|
97 | int i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg);
|
---|
98 |
|
---|
99 | protected:
|
---|
100 |
|
---|
101 | struct
|
---|
102 | {
|
---|
103 | bool mfTransferIsPending;
|
---|
104 | /** Maximum data block size (in bytes) the target can handle. */
|
---|
105 | uint32_t mcbBlockSize;
|
---|
106 | } mData;
|
---|
107 |
|
---|
108 | friend class SendDataTask;
|
---|
109 | };
|
---|
110 |
|
---|
111 | #endif /* !MAIN_INCLUDED_GuestDnDTargetImpl_h */
|
---|
112 |
|
---|