VirtualBox

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

Last change on this file since 77110 was 76562, checked in by vboxsync, 6 years ago

Main: Use MAIN_INCLUDED_ and MAIN_INCLUDED_SRC_ as header guard prefixes with scm.

  • 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 76562 2019-01-01 03:22:50Z vboxsync $ */
2/** @file
3 * VBox Console COM Class implementation - Guest drag'n drop source.
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_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 RecvDataTask;
33struct RECVDATACTX;
34typedef struct RECVDATACTX *PRECVDATACTX;
35
36class ATL_NO_VTABLE GuestDnDSource :
37 public GuestDnDSourceWrap,
38 public GuestDnDBase
39{
40public:
41 /** @name COM and internal init/term/mapping cruft.
42 * @{ */
43 DECLARE_EMPTY_CTOR_DTOR(GuestDnDSource)
44
45 int init(const ComObjPtr<Guest>& pGuest);
46 void uninit(void);
47
48 HRESULT FinalConstruct(void);
49 void FinalRelease(void);
50 /** @} */
51
52private:
53
54 /** Private wrapped @name IDnDBase methods.
55 * @{ */
56 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
57 HRESULT getFormats(GuestDnDMIMEList &aFormats);
58 HRESULT addFormats(const GuestDnDMIMEList &aFormats);
59 HRESULT removeFormats(const GuestDnDMIMEList &aFormats);
60
61 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
62 /** @} */
63
64 /** Private wrapped @name IDnDSource methods.
65 * @{ */
66 HRESULT dragIsPending(ULONG uScreenId, GuestDnDMIMEList &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction);
67 HRESULT drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress);
68 HRESULT receiveData(std::vector<BYTE> &aData);
69 /** @} */
70
71protected:
72
73#ifdef VBOX_WITH_DRAG_AND_DROP_GH
74 /** @name Dispatch handlers for the HGCM callbacks.
75 * @{ */
76 int i_onReceiveDataHdr(PRECVDATACTX pCtx, PVBOXDNDSNDDATAHDR pDataHdr);
77 int i_onReceiveData(PRECVDATACTX pCtx, PVBOXDNDSNDDATA pSndData);
78 int i_onReceiveDir(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode);
79 int i_onReceiveFileHdr(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint64_t cbSize, uint32_t fMode, uint32_t fFlags);
80 int i_onReceiveFileData(PRECVDATACTX pCtx,const void *pvData, uint32_t cbData);
81 /** @} */
82#endif
83
84protected:
85
86 static Utf8Str i_guestErrorToString(int guestRc);
87 static Utf8Str i_hostErrorToString(int hostRc);
88
89 /** @name Thread task .
90 * @{ */
91 static void i_receiveDataThreadTask(RecvDataTask *pTask);
92 /** @} */
93
94 /** @name Callbacks for dispatch handler.
95 * @{ */
96 static DECLCALLBACK(int) i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
97 static DECLCALLBACK(int) i_receiveURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
98 /** @} */
99
100protected:
101
102 int i_receiveData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
103 int i_receiveRawData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
104 int i_receiveURIData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
105
106protected:
107
108 struct
109 {
110 /** Maximum data block size (in bytes) the source can handle. */
111 uint32_t mcbBlockSize;
112 /** The context for receiving data from the guest.
113 * At the moment only one transfer at a time is supported. */
114 RECVDATACTX mRecvCtx;
115 } mData;
116
117 friend class RecvDataTask;
118};
119
120#endif /* !MAIN_INCLUDED_GuestDnDSourceImpl_h */
121
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