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