Index: trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 85743)
+++ trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 85744)
@@ -161,6 +161,6 @@
      *  nor 2) mixed transfers (G->H + H->G at the same time).
      */
-    m_pResp = GuestDnDInst()->response();
-    AssertPtrReturn(m_pResp, E_POINTER);
+    m_pState = GuestDnDInst()->getState();
+    AssertPtrReturn(m_pState, E_POINTER);
 
     /* Confirm a successful initialization when it's the case. */
@@ -316,5 +316,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_ENTER);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -329,6 +329,6 @@
         if (RT_SUCCESS(rc))
         {
-            if (RT_SUCCESS(m_pResp->waitForGuestResponse()))
-                resAction = GuestDnD::toMainAction(m_pResp->getActionDefault());
+            if (RT_SUCCESS(m_pState->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(m_pState->getActionDefault());
         }
     }
@@ -393,5 +393,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_MOVE);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -406,7 +406,7 @@
         if (RT_SUCCESS(rc))
         {
-            GuestDnDResponse *pResp = GuestDnDInst()->response();
-            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
-                resAction = GuestDnD::toMainAction(pResp->getActionDefault());
+            GuestDnDState *pState = GuestDnDInst()->getState();
+            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(pState->getActionDefault());
         }
     }
@@ -440,5 +440,5 @@
     GuestDnDMsg Msg;
     Msg.setType(HOST_DND_HG_EVT_LEAVE);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         Msg.appendUInt32(0); /** @todo ContextID not used yet. */
 
@@ -446,7 +446,7 @@
     if (RT_SUCCESS(rc))
     {
-        GuestDnDResponse *pResp = GuestDnDInst()->response();
-        if (pResp)
-            pResp->waitForGuestResponse();
+        GuestDnDState *pState = GuestDnDInst()->getState();
+        if (pState)
+            pState->waitForGuestResponse();
     }
 
@@ -516,5 +516,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_DROPPED);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -529,10 +529,10 @@
         if (RT_SUCCESS(vrc))
         {
-            GuestDnDResponse *pResp = GuestDnDInst()->response();
-            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
+            GuestDnDState *pState = GuestDnDInst()->getState();
+            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
             {
-                resAct = GuestDnD::toMainAction(pResp->getActionDefault());
-
-                GuestDnDMIMEList lstFormats = pResp->formats();
+                resAct = GuestDnD::toMainAction(pState->getActionDefault());
+
+                GuestDnDMIMEList lstFormats = pState->formats();
                 if (lstFormats.size() == 1) /* Exactly one format to use specified? */
                 {
@@ -606,7 +606,7 @@
 
     /* Reset progress object. */
-    GuestDnDResponse *pResp = GuestDnDInst()->response();
-    AssertPtr(pResp);
-    HRESULT hr = pResp->resetProgress(m_pGuest);
+    GuestDnDState *pState = GuestDnDInst()->getState();
+    AssertPtr(pState);
+    HRESULT hr = pState->resetProgress(m_pGuest);
     if (FAILED(hr))
         return hr;
@@ -619,5 +619,5 @@
 
         mData.mSendCtx.pTarget   = this;
-        mData.mSendCtx.pResp     = pResp;
+        mData.mSendCtx.pState    = pState;
         mData.mSendCtx.uScreenID = aScreenId;
 
@@ -654,5 +654,5 @@
 
         /* Return progress to caller. */
-        hr = pResp->queryProgressTo(aProgress.asOutParam());
+        hr = pState->queryProgressTo(aProgress.asOutParam());
         ComAssertComRC(hr);
     }
@@ -835,5 +835,5 @@
     const char   *pcszFmt = pCtx->Meta.strFmt.c_str();
 
-    LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pResp->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
+    LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pState->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
 
     LogRel2(("DnD: Sending meta data to guest as '%s' (%zu bytes)\n", pcszFmt, cbData));
@@ -853,5 +853,5 @@
         Msg.setType(HOST_DND_HG_SND_DATA);
 
-        if (m_pResp->m_uProtocolVersion < 3)
+        if (m_pState->m_uProtocolVersion < 3)
         {
             Msg.appendUInt32(pCtx->uScreenID);                                 /* uScreenId */
@@ -883,5 +883,5 @@
     if (RT_SUCCESS(rc))
     {
-        rc = updateProgress(pCtx, pCtx->pResp, (uint32_t)pCtx->Meta.cbData);
+        rc = updateProgress(pCtx, pCtx->pState, (uint32_t)pCtx->Meta.cbData);
         AssertRC(rc);
     }
@@ -901,5 +901,5 @@
     AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
 
-    if (m_pResp->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
+    if (m_pState->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
         return VINF_SUCCESS;
 
@@ -950,5 +950,5 @@
 
     pMsg->setType(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         pMsg->appendUInt32(0); /** @todo ContextID not used yet. */
     pMsg->appendString(pcszDstPath);                    /* path */
@@ -997,5 +997,5 @@
     if (RT_SUCCESS(rc))
     {
-        if (m_pResp->m_uProtocolVersion >= 2)
+        if (m_pState->m_uProtocolVersion >= 2)
         {
             if (!(pCtx->Transfer.fObjState & DND_OBJ_STATE_HAS_HDR))
@@ -1067,5 +1067,5 @@
     AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
 
-    AssertPtrReturn(pCtx->pResp, VERR_WRONG_ORDER);
+    AssertPtrReturn(pCtx->pState, VERR_WRONG_ORDER);
 
     /** @todo Don't allow concurrent reads per context! */
@@ -1079,5 +1079,5 @@
     /* Protocol version 1 sends the file path *every* time with a new file chunk.
      * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */
-    if (m_pResp->m_uProtocolVersion <= 1)
+    if (m_pState->m_uProtocolVersion <= 1)
     {
         const size_t cchDstPath = RTStrNLen(pcszDstPath, RTPATH_MAX);
@@ -1086,5 +1086,5 @@
         pMsg->appendUInt32((uint32_t)cchDstPath + 1); /* cbName */
     }
-    else if (m_pResp->m_uProtocolVersion >= 2)
+    else if (m_pState->m_uProtocolVersion >= 2)
     {
         pMsg->appendUInt32(0);                        /** @todo ContextID not used yet. */
@@ -1103,5 +1103,5 @@
         LogFlowFunc(("cbBufe=%zu, cbRead=%RU32\n", cbBuf, cbRead));
 
-        if (m_pResp->m_uProtocolVersion <= 1)
+        if (m_pState->m_uProtocolVersion <= 1)
         {
             pMsg->appendPointer(pvBuf, cbRead);                            /* pvData */
@@ -1114,5 +1114,5 @@
             pMsg->appendUInt32(cbRead);                                    /* cbData */
 
-            if (m_pResp->m_uProtocolVersion >= 3)
+            if (m_pState->m_uProtocolVersion >= 3)
             {
                 /** @todo Calculate checksum. */
@@ -1122,5 +1122,5 @@
         }
 
-        int rc2 = updateProgress(pCtx, pCtx->pResp, (uint32_t)cbRead);
+        int rc2 = updateProgress(pCtx, pCtx->pState, (uint32_t)cbRead);
         AssertRC(rc2);
 
@@ -1223,5 +1223,5 @@
             AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
-            pCtx->pResp->reset();
+            pCtx->pState->reset();
 
             if (RT_SUCCESS(pCBData->rc))
@@ -1231,6 +1231,6 @@
             }
 
-            rc = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
-                                          GuestDnDTarget::i_guestErrorToString(pCBData->rc));
+            rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
+                                           GuestDnDTarget::i_guestErrorToString(pCBData->rc));
             if (RT_SUCCESS(rc))
             {
@@ -1343,6 +1343,6 @@
     {
         /* Unregister this callback. */
-        AssertPtr(pCtx->pResp);
-        int rc2 = pCtx->pResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
+        AssertPtr(pCtx->pState);
+        int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
         AssertRC(rc2);
 
@@ -1373,9 +1373,9 @@
 {
     AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
-    AssertPtr(pCtx->pResp);
+    AssertPtr(pCtx->pState);
 
 #define REGISTER_CALLBACK(x)                                                 \
     do {                                                                     \
-        rc = pCtx->pResp->setCallback(x, i_sendTransferDataCallback, pCtx); \
+        rc = pCtx->pState->setCallback(x, i_sendTransferDataCallback, pCtx); \
         if (RT_FAILURE(rc))                                                  \
             return rc;                                                       \
@@ -1384,5 +1384,5 @@
 #define UNREGISTER_CALLBACK(x)                        \
     do {                                              \
-        int rc2 = pCtx->pResp->setCallback(x, NULL); \
+        int rc2 = pCtx->pState->setCallback(x, NULL); \
         AssertRC(rc2);                                \
     } while (0)
@@ -1406,5 +1406,5 @@
     /* Host callbacks. */
     REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 2)
+    if (m_pState->m_uProtocolVersion >= 2)
         REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
     REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
@@ -1473,5 +1473,5 @@
          * Send the data header first.
          */
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             rc = i_sendMetaDataHeader(pCtx);
 
@@ -1484,7 +1484,7 @@
         if (RT_SUCCESS(rc))
         {
-            rc = waitForEvent(&pCtx->EventCallback, pCtx->pResp, msTimeout);
+            rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout);
             if (RT_SUCCESS(rc))
-                pCtx->pResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
+                pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
         }
 
@@ -1501,5 +1501,5 @@
     /* Host callbacks. */
     UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 2)
+    if (m_pState->m_uProtocolVersion >= 2)
         UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
     UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
@@ -1522,5 +1522,5 @@
             LogRel2(("DnD: Sending transfer data to guest cancelled by user\n"));
 
-            rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
+            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
             AssertRC(rc2);
 
@@ -1531,6 +1531,6 @@
         {
             LogRel(("DnD: Sending transfer data to guest failed with rc=%Rrc\n", rc));
-            int rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, rc,
-                                               GuestDnDTarget::i_hostErrorToString(rc));
+            int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, rc,
+                                                GuestDnDTarget::i_hostErrorToString(rc));
             AssertRC(rc2);
         }
@@ -1555,5 +1555,5 @@
     AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
 
-    int rc = updateProgress(pCtx, pCtx->pResp);
+    int rc = updateProgress(pCtx, pCtx->pState);
     AssertRCReturn(rc, rc);
 
@@ -1619,9 +1619,9 @@
     {
         LogRel(("DnD: Sending raw data to guest failed with rc=%Rrc\n", rc));
-        rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
-                                       GuestDnDTarget::i_hostErrorToString(rc));
+        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
+                                        GuestDnDTarget::i_hostErrorToString(rc));
     }
     else
-        rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
+        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
     AssertRC(rc2);
 
