VirtualBox

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

Last change on this file since 56290 was 55963, checked in by vboxsync, 9 years ago

DnD: Fixed hang when reporting host errors such as inaccessible (locked) files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: GuestDnDTargetImpl.h 55963 2015-05-20 11:18:14Z vboxsync $ */
2/** @file
3 * VBox Console COM Class implementation - Guest drag'n drop target.
4 */
5
6/*
7 * Copyright (C) 2014-2015 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
27struct SENDDATACTX;
28typedef struct SENDDATACTX *PSENDDATACTX;
29
30class ATL_NO_VTABLE GuestDnDTarget :
31 public GuestDnDTargetWrap,
32 public GuestDnDBase
33{
34public:
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
46private:
47
48 /** Private wrapped @name IDnDBase methods.
49 * @{ */
50 HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
51 HRESULT getFormats(std::vector<com::Utf8Str> &aFormats);
52 HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats);
53 HRESULT removeFormats(const std::vector<com::Utf8Str> &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 std::vector<com::Utf8Str> &aFormats, DnDAction_T *aResultAction);
61 HRESULT move(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const std::vector<com::Utf8Str> &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 std::vector<com::Utf8Str> &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
68protected:
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
83protected:
84
85 int i_cancelOperation(void);
86 int i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
87 int i_sendDirectory(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aDirectory);
88 int i_sendFile(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile);
89 int i_sendFileData(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile);
90 int i_sendURIData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
91 int i_sendRawData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
92 int i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg);
93
94protected:
95
96 struct
97 {
98 bool mfTransferIsPending;
99 /** Maximum data block size (in bytes) the target can handle. */
100 uint32_t mcbBlockSize;
101 } mData;
102};
103
104#endif /* !____H_GUESTDNDTARGETIMPL */
105
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