GuestDnDTargetImpl.cpp revision 8f32c587d66eb1633f87183c1d750abe7f4b372c
/* $Id$ */
/** @file
* VBox Console COM Class implementation - Guest drag'n drop target.
*/
/*
* Copyright (C) 2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "GuestImpl.h"
#include "GuestDnDTargetImpl.h"
#include "Global.h"
#include "AutoCaller.h"
#include <algorithm> /* For std::find(). */
#ifdef LOG_GROUP
#endif
#define LOG_GROUP LOG_GROUP_GUEST_DND
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc(("\n"));
return BaseFinalConstruct();
}
void GuestDnDTarget::FinalRelease(void)
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
{
/* Enclose the state transition NotReady->InInit->Ready. */
AutoInitSpan autoInitSpan(this);
/* Confirm a successful initialization when it's the case. */
return VINF_SUCCESS;
}
/**
* Uninitializes the instance.
* Called from FinalRelease().
*/
void GuestDnDTarget::uninit(void)
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady. */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
// implementation of wrapped IDnDBase methods.
/////////////////////////////////////////////////////////////////////////////
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
// implementation of wrapped IDnDTarget methods.
/////////////////////////////////////////////////////////////////////////////
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
/* Input validation. */
if (aDefaultAction == DnDAction_Ignore)
if (!aAllowedActions.size())
AutoCaller autoCaller(this);
/* Default action is ignoring. */
/* Check & convert the drag & drop actions */
uint32_t uDefAction = 0;
uint32_t uAllowedActions = 0;
/* If there is no usable action, ignore this request. */
if (isDnDIgnoreAction(uDefAction))
return S_OK;
/* Make a flat data string out of the supported format list. */
/* If there is no valid supported format, ignore this request. */
if (strFormats.isEmpty())
return S_OK;
/* Adjust the coordinates in a multi-monitor setup. */
if (RT_SUCCESS(rc))
{
int i = 0;
i, paParms);
if (RT_SUCCESS(rc))
{
}
}
if (aResultAction)
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
/* Input validation. */
AutoCaller autoCaller(this);
/* Default action is ignoring. */
/* Check & convert the drag & drop actions. */
uint32_t uDefAction = 0;
uint32_t uAllowedActions = 0;
/* If there is no usable action, ignore this request. */
if (isDnDIgnoreAction(uDefAction))
return S_OK;
/* Make a flat data string out of the supported format list. */
/* If there is no valid supported format, ignore this request. */
if (strFormats.isEmpty())
return S_OK;
if (RT_SUCCESS(rc))
{
int i = 0;
i, paParms);
if (RT_SUCCESS(rc))
{
}
}
if (aResultAction)
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
AutoCaller autoCaller(this);
if (RT_SUCCESS(rc))
{
if (pResp)
}
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
/* Input validation. */
/* Everything else is optional. */
AutoCaller autoCaller(this);
/* Default action is ignoring. */
/* Check & convert the drag & drop actions. */
uint32_t uDefAction = 0;
uint32_t uAllowedActions = 0;
/* If there is no usable action, ignore this request. */
if (isDnDIgnoreAction(uDefAction))
return S_OK;
/* Make a flat data string out of the supported format list. */
/* If there is no valid supported format, ignore this request. */
if (strFormats.isEmpty())
return S_OK;
/* Adjust the coordinates in a multi-monitor setup. */
if (RT_SUCCESS(rc))
{
int i = 0;
i, paParms);
if (RT_SUCCESS(rc))
{
{
LogFlowFunc(("resFormat=%s, resAction=%RU32\n",
}
}
}
if (aResultAction)
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}
{
#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
#else /* VBOX_WITH_DRAG_AND_DROP */
/* Input validation */
AutoCaller autoCaller(this);
int i = 0;
if (pResp)
{
/* Reset any old progress status. */
/* Note: The actual data transfer of files/directoies is performed by the
* DnD host service. */
i, paParms);
if (RT_SUCCESS(rc))
{
/* Query the progress object to the caller. */
if (aProgress)
}
}
return hr;
#endif /* VBOX_WITH_DRAG_AND_DROP */
}