VirtualBox

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

Last change on this file since 62485 was 62485, checked in by vboxsync, 8 years ago

(C) 2016

  • 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 62485 2016-07-22 18:36:43Z vboxsync $ */
2/** @file
3 * VBox Console COM Class implementation - Guest drag'n drop source.
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_GUESTDNDSOURCEIMPL
19#define ____H_GUESTDNDSOURCEIMPL
20
21#include <VBox/GuestHost/DragAndDrop.h>
22#include <VBox/HostServices/DragAndDropSvc.h>
23
24using namespace DragAndDropSvc;
25
26#include "GuestDnDSourceWrap.h"
27#include "GuestDnDPrivate.h"
28
29struct RECVDATACTX;
30typedef struct RECVDATACTX *PRECVDATACTX;
31
32class ATL_NO_VTABLE GuestDnDSource :
33 public GuestDnDSourceWrap,
34 public GuestDnDBase
35{
36public:
37 /** @name COM and internal init/term/mapping cruft.
38 * @{ */
39 DECLARE_EMPTY_CTOR_DTOR(GuestDnDSource)
40
41 int init(const ComObjPtr<Guest>& pGuest);
42 void uninit(void);
43
44 HRESULT FinalConstruct(void);
45 void FinalRelease(void);
46 /** @} */
47
48private:
49
50 /** Private wrapped @name IDnDBase methods.
51 * @{ */
52 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
53 HRESULT getFormats(GuestDnDMIMEList &aFormats);
54 HRESULT addFormats(const GuestDnDMIMEList &aFormats);
55 HRESULT removeFormats(const GuestDnDMIMEList &aFormats);
56
57 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
58 /** @} */
59
60 /** Private wrapped @name IDnDSource methods.
61 * @{ */
62 HRESULT dragIsPending(ULONG uScreenId, GuestDnDMIMEList &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction);
63 HRESULT drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress);
64 HRESULT receiveData(std::vector<BYTE> &aData);
65 /** @} */
66
67protected:
68
69#ifdef VBOX_WITH_DRAG_AND_DROP_GH
70 /** @name Dispatch handlers for the HGCM callbacks.
71 * @{ */
72 int i_onReceiveDataHdr(PRECVDATACTX pCtx, PVBOXDNDSNDDATAHDR pDataHdr);
73 int i_onReceiveData(PRECVDATACTX pCtx, PVBOXDNDSNDDATA pSndData);
74 int i_onReceiveDir(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode);
75 int i_onReceiveFileHdr(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint64_t cbSize, uint32_t fMode, uint32_t fFlags);
76 int i_onReceiveFileData(PRECVDATACTX pCtx,const void *pvData, uint32_t cbData);
77 /** @} */
78#endif
79
80protected:
81
82 static Utf8Str i_guestErrorToString(int guestRc);
83 static Utf8Str i_hostErrorToString(int hostRc);
84
85 /** @name Thread callbacks.
86 * @{ */
87 static DECLCALLBACK(int) i_receiveDataThread(RTTHREAD Thread, void *pvUser);
88 /** @} */
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_receiveURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
94 /** @} */
95
96protected:
97
98 int i_receiveData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
99 int i_receiveRawData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
100 int i_receiveURIData(PRECVDATACTX 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 RECVDATACTX mRecvCtx;
111 } mData;
112
113 friend class RecvDataTask;
114};
115
116#endif /* !____H_GUESTDNDSOURCEIMPL */
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