- Timestamp:
- Aug 13, 2020 8:28:29 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139892
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r85739 r85744 37 37 class Guest; 38 38 class GuestDnDBase; 39 class GuestDnD Response;39 class GuestDnDState; 40 40 class GuestDnDSource; 41 41 class GuestDnDTarget; … … 481 481 /** Pointer to guest target class this context belongs to. */ 482 482 GuestDnDTarget *pTarget; 483 /** Pointer to guest response classthis context belongs to. */484 GuestDnD Response *pResp;483 /** Pointer to guest state this context belongs to. */ 484 GuestDnDState *pState; 485 485 /** Target (VM) screen ID. */ 486 486 uint32_t uScreenID; … … 558 558 /** Pointer to guest source class this context belongs to. */ 559 559 GuestDnDSource *pSource; 560 /** Pointer to guest response classthis context belongs to. */561 GuestDnD Response *pResp;560 /** Pointer to guest state this context belongs to. */ 561 GuestDnDState *pState; 562 562 /** Formats offered by the guest (and supported by the host). */ 563 563 GuestDnDMIMEList lstFmtOffered; … … 797 797 typedef std::map<uint32_t, GuestDnDCallback> GuestDnDCallbackMap; 798 798 799 /** @todo r=andy This class needs to go, as this now is too inflexible when it comes to all800 * the callback handling/dispatching. It's part of the initial code and only adds801 * unnecessary complexity. */802 class GuestDnD Response803 { 804 805 public: 806 807 GuestDnD Response(const ComObjPtr<Guest>& pGuest);808 virtual ~GuestDnD Response(void);799 /** 800 * Class for keeping a DnD guest state around. 801 */ 802 class GuestDnDState 803 { 804 805 public: 806 807 GuestDnDState(const ComObjPtr<Guest>& pGuest); 808 virtual ~GuestDnDState(void); 809 809 810 810 public: … … 925 925 * @{ */ 926 926 HRESULT adjustScreenCoordinates(ULONG uScreenId, ULONG *puX, ULONG *puY) const; 927 GuestDnDState *getState(uint32_t = 0) const; 927 928 int hostCall(uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const; 928 GuestDnDResponse *response(void) { return m_pResponse; }929 929 GuestDnDMIMEList defaultFormats(void) const { return m_strDefaultFormats; } 930 930 /** @} */ … … 968 968 /** Pointer to guest implementation. */ 969 969 const ComObjPtr<Guest> m_pGuest; 970 /** The current (last) response from the guest. At the971 * moment we only support only response a time (ARQ-style). */972 GuestDnD Response *m_pResponse;970 /** The current state from the guest. At the 971 * moment we only support only state a time (ARQ-style). */ 972 GuestDnDState *m_pState; 973 973 /** Critical section to serialize access. */ 974 974 RTCRITSECT m_CritSect; … … 1022 1022 1023 1023 int sendCancel(void); 1024 int updateProgress(GuestDnDData *pData, GuestDnD Response *pResp, size_t cbDataAdd = 0);1025 int waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnD Response *pResp, RTMSINTERVAL msTimeout);1024 int updateProgress(GuestDnDData *pData, GuestDnDState *pState, size_t cbDataAdd = 0); 1025 int waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDState *pState, RTMSINTERVAL msTimeout); 1026 1026 1027 1027 protected: … … 1037 1037 /** Whether the object still is in pending state. */ 1038 1038 bool m_fIsPending; 1039 /** Pointer to response bound to this object. */1040 GuestDnD Response *m_pResp;1039 /** Pointer to state bound to this object. */ 1040 GuestDnDState *m_pState; 1041 1041 /** @} */ 1042 1042 -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r85739 r85744 184 184 GuestDnDSendCtx::GuestDnDSendCtx(void) 185 185 : pTarget(NULL) 186 , p Resp(NULL)186 , pState(NULL) 187 187 { 188 188 reset(); … … 194 194 void GuestDnDSendCtx::reset(void) 195 195 { 196 if (p Resp)197 p Resp->reset();196 if (pState) 197 pState->reset(); 198 198 199 199 uScreenID = 0; … … 213 213 GuestDnDRecvCtx::GuestDnDRecvCtx(void) 214 214 : pSource(NULL) 215 , p Resp(NULL)215 , pState(NULL) 216 216 { 217 217 reset(); … … 223 223 void GuestDnDRecvCtx::reset(void) 224 224 { 225 if (p Resp)226 p Resp->reset();225 if (pState) 226 pState->reset(); 227 227 228 228 lstFmtOffered.clear(); … … 290 290 ********************************************************************************************************************************/ 291 291 292 GuestDnD Response::GuestDnDResponse(const ComObjPtr<Guest>& pGuest)292 GuestDnDState::GuestDnDState(const ComObjPtr<Guest>& pGuest) 293 293 : m_uProtocolVersion(0) 294 294 , m_fGuestFeatures0(VBOX_DND_GF_NONE) … … 303 303 } 304 304 305 GuestDnD Response::~GuestDnDResponse(void)305 GuestDnDState::~GuestDnDState(void) 306 306 { 307 307 reset(); … … 314 314 * Notifies the waiting side about a guest notification response. 315 315 */ 316 int GuestDnD Response::notifyAboutGuestResponse(void) const316 int GuestDnDState::notifyAboutGuestResponse(void) const 317 317 { 318 318 return RTSemEventSignal(m_EventSem); … … 322 322 * Resets a GuestDnDResponse object. 323 323 */ 324 void GuestDnD Response::reset(void)324 void GuestDnDState::reset(void) 325 325 { 326 326 LogFlowThisFuncEnter(); … … 338 338 * @param pParent Parent to set for the progress object. 339 339 */ 340 HRESULT GuestDnD Response::resetProgress(const ComObjPtr<Guest>& pParent)340 HRESULT GuestDnDState::resetProgress(const ComObjPtr<Guest>& pParent) 341 341 { 342 342 m_pProgress.setNull(); … … 358 358 * @returns \c true if canceled, \c false if not. 359 359 */ 360 bool GuestDnD Response::isProgressCanceled(void) const360 bool GuestDnDState::isProgressCanceled(void) const 361 361 { 362 362 BOOL fCanceled; … … 380 380 * @param pvUser User-provided arguments for the callback function. Optional and can be NULL. 381 381 */ 382 int GuestDnD Response::setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser /* = NULL */)382 int GuestDnDState::setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser /* = NULL */) 383 383 { 384 384 GuestDnDCallbackMap::iterator it = m_mapCallbacks.find(uMsg); … … 413 413 * @param strMsg Message to set. Optional. 414 414 */ 415 int GuestDnD Response::setProgress(unsigned uPercentage, uint32_t uStatus,416 415 int GuestDnDState::setProgress(unsigned uPercentage, uint32_t uStatus, 416 int rcOp /* = VINF_SUCCESS */, const Utf8Str &strMsg /* = "" */) 417 417 { 418 418 LogFlowFunc(("uPercentage=%u, uStatus=%RU32, , rcOp=%Rrc, strMsg=%s\n", … … 516 516 * @param cbParms Size (in bytes) of \a pvParms. 517 517 */ 518 int GuestDnD Response::onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms)518 int GuestDnDState::onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms) 519 519 { 520 520 LogFlowFunc(("u32Function=%RU32, pvParms=%p, cbParms=%RU32\n", u32Function, pvParms, cbParms)); … … 687 687 * @param ppProgress Where to query the progress object to. 688 688 */ 689 HRESULT GuestDnD Response::queryProgressTo(IProgress **ppProgress)689 HRESULT GuestDnDState::queryProgressTo(IProgress **ppProgress) 690 690 { 691 691 return m_pProgress.queryInterfaceTo(ppProgress); … … 698 698 * @param msTimeout Timeout (in ms) for waiting. Optional, waits 500 ms if not specified. 699 699 */ 700 int GuestDnD Response::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */) const700 int GuestDnDState::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */) const 701 701 { 702 702 int rc = RTSemEventWait(m_EventSem, msTimeout); … … 722 722 try 723 723 { 724 m_p Response = new GuestDnDResponse(pGuest);724 m_pState = new GuestDnDState(pGuest); 725 725 } 726 726 catch (std::bad_alloc &) … … 751 751 RTCritSectDelete(&m_CritSect); 752 752 753 if (m_p Response)754 delete m_p Response;753 if (m_pState) 754 delete m_pState; 755 755 } 756 756 … … 794 794 795 795 /** 796 * Returns a DnD guest state. 797 * 798 * @returns Pointer to DnD guest state, or NULL if not found / invalid. 799 * @param uID ID of DnD guest state to return. 800 */ 801 GuestDnDState *GuestDnD::getState(uint32_t uID /* = 0 */) const 802 { 803 AssertMsgReturn(uID == 0, ("Only one state (0) is supported at the moment\n"), NULL); 804 805 return m_pState; 806 } 807 808 /** 796 809 * Sends a (blocking) message to the host side of the host service. 797 810 * … … 941 954 * would be the place to lookup and dispatch to those. For the moment we 942 955 * only have one response -- simple. */ 943 GuestDnDResponse *pResp = pGuestDnD->m_pResponse; 944 if (pResp) 945 return pResp->onDispatch(u32Function, pvParms, cbParms); 956 if (pGuestDnD->m_pState) 957 return pGuestDnD->m_pState->onDispatch(u32Function, pvParms, cbParms); 946 958 947 959 return VERR_NOT_SUPPORTED; … … 1308 1320 GuestDnDMsg Msg; 1309 1321 Msg.setType(HOST_DND_CANCEL); 1310 if (m_p Resp->m_uProtocolVersion >= 3)1322 if (m_pState->m_uProtocolVersion >= 3) 1311 1323 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 1312 1324 … … 1325 1337 * @returns VBox status code. 1326 1338 * @param pData GuestDnDData object to use for accounting. 1327 * @param p Resp GuestDnDResponse to update its progress object for.1339 * @param pState Guest state to update its progress object for. 1328 1340 * @param cbDataAdd By how much data (in bytes) to update the progress. 1329 1341 */ 1330 int GuestDnDBase::updateProgress(GuestDnDData *pData, GuestDnD Response *pResp,1342 int GuestDnDBase::updateProgress(GuestDnDData *pData, GuestDnDState *pState, 1331 1343 size_t cbDataAdd /* = 0 */) 1332 1344 { 1333 1345 AssertPtrReturn(pData, VERR_INVALID_POINTER); 1334 AssertPtrReturn(p Resp, VERR_INVALID_POINTER);1346 AssertPtrReturn(pState, VERR_INVALID_POINTER); 1335 1347 /* cbDataAdd is optional. */ 1336 1348 … … 1338 1350 pData->cbExtra, pData->cbProcessed, pData->getRemaining(), cbDataAdd)); 1339 1351 1340 if ( !p Resp1352 if ( !pState 1341 1353 || !cbDataAdd) /* Only update if something really changes. */ 1342 1354 return VINF_SUCCESS; … … 1349 1361 LogRel2(("DnD: Transfer %RU8%% complete\n", uPercent)); 1350 1362 1351 int rc = p Resp->setProgress(uPercent,1352 pData->isComplete()1353 ? DND_PROGRESS_COMPLETE1354 : DND_PROGRESS_RUNNING);1363 int rc = pState->setProgress(uPercent, 1364 pData->isComplete() 1365 ? DND_PROGRESS_COMPLETE 1366 : DND_PROGRESS_RUNNING); 1355 1367 LogFlowFuncLeaveRC(rc); 1356 1368 return rc; … … 1360 1372 * Waits for a specific guest callback event to get signalled. 1361 1373 * 1362 ** @todo GuestDnDResponse *pResp needs to go.1363 *1364 1374 * @returns VBox status code. Will return VERR_CANCELLED if the user has cancelled the progress object. 1365 1375 * @param pEvent Callback event to wait for. 1366 * @param p Resp Response to update.1376 * @param pState Guest state to update. 1367 1377 * @param msTimeout Timeout (in ms) to wait. 1368 1378 */ 1369 int GuestDnDBase::waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnD Response *pResp, RTMSINTERVAL msTimeout)1379 int GuestDnDBase::waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDState *pState, RTMSINTERVAL msTimeout) 1370 1380 { 1371 1381 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 1372 AssertPtrReturn(p Resp, VERR_INVALID_POINTER);1382 AssertPtrReturn(pState, VERR_INVALID_POINTER); 1373 1383 1374 1384 int rc; … … 1400 1410 LogRel2(("DnD: Error: Guest did not respond within time\n")); 1401 1411 } 1402 else if (p Resp->isProgressCanceled()) /** @todo GuestDnDResponse *pResp needs to go. */1412 else if (pState->isProgressCanceled()) 1403 1413 { 1404 1414 LogRel2(("DnD: Operation was canceled by user\n")); -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r85743 r85744 163 163 * nor 2) mixed transfers (G->H + H->G at the same time). 164 164 */ 165 m_p Resp = GuestDnDInst()->response();166 AssertPtrReturn(m_p Resp, E_POINTER);165 m_pState = GuestDnDInst()->getState(); 166 AssertPtrReturn(m_pState, E_POINTER); 167 167 168 168 /* Confirm a successful initialization when it's the case. */ … … 276 276 GuestDnDMsg Msg; 277 277 Msg.setType(HOST_DND_GH_REQ_PENDING); 278 if (m_p Resp->m_uProtocolVersion >= 3)278 if (m_pState->m_uProtocolVersion >= 3) 279 279 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 280 280 Msg.appendUInt32(uScreenId); … … 283 283 if (RT_SUCCESS(rc)) 284 284 { 285 GuestDnD Response *pResp = GuestDnDInst()->response();286 AssertPtr(p Resp);285 GuestDnDState *pState = GuestDnDInst()->getState(); 286 AssertPtr(pState); 287 287 288 288 bool fFetchResult = true; 289 289 290 rc = p Resp->waitForGuestResponse(100 /* Timeout in ms */);290 rc = pState->waitForGuestResponse(100 /* Timeout in ms */); 291 291 if (RT_FAILURE(rc)) 292 292 fFetchResult = false; 293 293 294 294 if ( fFetchResult 295 && isDnDIgnoreAction(p Resp->getActionDefault()))295 && isDnDIgnoreAction(pState->getActionDefault())) 296 296 fFetchResult = false; 297 297 … … 305 305 * which are not supported by the host. 306 306 */ 307 GuestDnDMIMEList lstFiltered = GuestDnD::toFilteredFormatList(m_lstFmtSupported, p Resp->formats());307 GuestDnDMIMEList lstFiltered = GuestDnD::toFilteredFormatList(m_lstFmtSupported, pState->formats()); 308 308 if (lstFiltered.size()) 309 309 { … … 313 313 314 314 aFormats = lstFiltered; 315 aAllowedActions = GuestDnD::toMainActions(p Resp->getActionsAllowed());315 aAllowedActions = GuestDnD::toMainActions(pState->getActionsAllowed()); 316 316 if (aDefaultAction) 317 *aDefaultAction = GuestDnD::toMainAction(p Resp->getActionDefault());317 *aDefaultAction = GuestDnD::toMainAction(pState->getActionDefault()); 318 318 319 319 /* Apply the (filtered) formats list. */ … … 324 324 } 325 325 326 LogFlowFunc(("fFetchResult=%RTbool, lstActionsAllowed=0x%x\n", fFetchResult, p Resp->getActionsAllowed()));326 LogFlowFunc(("fFetchResult=%RTbool, lstActionsAllowed=0x%x\n", fFetchResult, pState->getActionsAllowed())); 327 327 } 328 328 … … 370 370 371 371 /* Reset progress object. */ 372 GuestDnD Response *pResp = GuestDnDInst()->response();373 AssertPtr(p Resp);374 HRESULT hr = p Resp->resetProgress(m_pGuest);372 GuestDnDState *pState = GuestDnDInst()->getState(); 373 AssertPtr(pState); 374 HRESULT hr = pState->resetProgress(m_pGuest); 375 375 if (FAILED(hr)) 376 376 return hr; … … 381 381 { 382 382 mData.mRecvCtx.pSource = this; 383 mData.mRecvCtx.p Resp = pResp;383 mData.mRecvCtx.pState = pState; 384 384 mData.mRecvCtx.enmAction = dndAction; 385 385 mData.mRecvCtx.strFmtReq = aFormat; … … 419 419 GuestDnDInst()->registerSource(this); 420 420 421 hr = p Resp->queryProgressTo(aProgress.asOutParam());421 hr = pState->queryProgressTo(aProgress.asOutParam()); 422 422 ComAssertComRC(hr); 423 423 … … 665 665 size_t cbMetaAnnounced; 666 666 667 if (m_p Resp->m_uProtocolVersion < 3)667 if (m_pState->m_uProtocolVersion < 3) 668 668 { 669 669 cbData = pSndData->u.v1.cbData; … … 748 748 { 749 749 /* Update our process with the data we already received. */ 750 rc = updateProgress(pCtx, pCtx->p Resp, cbMetaAnnounced);750 rc = updateProgress(pCtx, pCtx->pState, cbMetaAnnounced); 751 751 AssertRC(rc); 752 752 } … … 757 757 else /* Raw data. */ 758 758 { 759 rc = updateProgress(pCtx, pCtx->p Resp, cbData);759 rc = updateProgress(pCtx, pCtx->pState, cbData); 760 760 AssertRC(rc); 761 761 } … … 882 882 883 883 /* Note: Protocol v1 does not send any file sizes, so always 0. */ 884 if (m_p Resp->m_uProtocolVersion >= 2)884 if (m_pState->m_uProtocolVersion >= 2) 885 885 rc = DnDTransferObjectSetSize(pObj, cbSize); 886 886 … … 966 966 } 967 967 968 rc = updateProgress(pCtx, pCtx->p Resp, cbWritten);968 rc = updateProgress(pCtx, pCtx->pState, cbWritten); 969 969 AssertRCBreak(rc); 970 970 … … 1104 1104 LogFlowFuncEnter(); 1105 1105 1106 GuestDnD Response *pResp = pCtx->pResp;1107 AssertPtr(pCtx->p Resp);1106 GuestDnDState *pState = pCtx->pState; 1107 AssertPtr(pCtx->pState); 1108 1108 1109 1109 GuestDnD *pInst = GuestDnDInst(); … … 1112 1112 1113 1113 #define REGISTER_CALLBACK(x) \ 1114 do { \1115 rc = p Resp->setCallback(x, i_receiveRawDataCallback, pCtx); \1116 if (RT_FAILURE(rc)) \1117 return rc; \1114 do { \ 1115 rc = pState->setCallback(x, i_receiveRawDataCallback, pCtx); \ 1116 if (RT_FAILURE(rc)) \ 1117 return rc; \ 1118 1118 } while (0) 1119 1119 1120 1120 #define UNREGISTER_CALLBACK(x) \ 1121 1121 do { \ 1122 int rc2 = p Resp->setCallback(x, NULL);\1122 int rc2 = pState->setCallback(x, NULL); \ 1123 1123 AssertRC(rc2); \ 1124 1124 } while (0) … … 1130 1130 REGISTER_CALLBACK(GUEST_DND_DISCONNECT); 1131 1131 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1132 if (m_p Resp->m_uProtocolVersion >= 3)1132 if (m_pState->m_uProtocolVersion >= 3) 1133 1133 REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR); 1134 1134 REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA); … … 1141 1141 GuestDnDMsg Msg; 1142 1142 Msg.setType(HOST_DND_GH_EVT_DROPPED); 1143 if (m_p Resp->m_uProtocolVersion >= 3)1143 if (m_pState->m_uProtocolVersion >= 3) 1144 1144 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 1145 1145 Msg.appendPointer((void*)pCtx->strFmtRecv.c_str(), (uint32_t)pCtx->strFmtRecv.length() + 1); … … 1152 1152 if (RT_SUCCESS(rc)) 1153 1153 { 1154 rc = waitForEvent(&pCtx->EventCallback, pCtx->p Resp, msTimeout);1154 rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout); 1155 1155 if (RT_SUCCESS(rc)) 1156 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);1156 rc = pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1157 1157 } 1158 1158 … … 1165 1165 UNREGISTER_CALLBACK(GUEST_DND_DISCONNECT); 1166 1166 UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1167 if (m_p Resp->m_uProtocolVersion >= 3)1167 if (m_pState->m_uProtocolVersion >= 3) 1168 1168 UNREGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR); 1169 1169 UNREGISTER_CALLBACK(GUEST_DND_GH_SND_DATA); … … 1184 1184 AssertRC(rc2); 1185 1185 1186 rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED);1186 rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED); 1187 1187 AssertRC(rc2); 1188 1188 } 1189 1189 else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */ 1190 1190 { 1191 int rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR,1192 rc, GuestDnDSource::i_hostErrorToString(rc));1191 int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, 1192 rc, GuestDnDSource::i_hostErrorToString(rc)); 1193 1193 AssertRC(rc2); 1194 1194 } … … 1216 1216 LogFlowFuncEnter(); 1217 1217 1218 GuestDnD Response *pResp = pCtx->pResp;1219 AssertPtr(pCtx->p Resp);1218 GuestDnDState *pState = pCtx->pState; 1219 AssertPtr(pCtx->pState); 1220 1220 1221 1221 GuestDnD *pInst = GuestDnDInst(); … … 1223 1223 return VERR_INVALID_POINTER; 1224 1224 1225 #define REGISTER_CALLBACK(x) \1226 do { \1227 rc = p Resp->setCallback(x, i_receiveTransferDataCallback, pCtx); \1228 if (RT_FAILURE(rc)) \1229 return rc; \1225 #define REGISTER_CALLBACK(x) \ 1226 do { \ 1227 rc = pState->setCallback(x, i_receiveTransferDataCallback, pCtx); \ 1228 if (RT_FAILURE(rc)) \ 1229 return rc; \ 1230 1230 } while (0) 1231 1231 1232 #define UNREGISTER_CALLBACK(x) \1233 do { \1234 int rc2 = p Resp->setCallback(x, NULL); \1235 AssertRC(rc2); \1232 #define UNREGISTER_CALLBACK(x) \ 1233 do { \ 1234 int rc2 = pState->setCallback(x, NULL); \ 1235 AssertRC(rc2); \ 1236 1236 } while (0) 1237 1237 … … 1243 1243 REGISTER_CALLBACK(GUEST_DND_DISCONNECT); 1244 1244 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1245 if (m_p Resp->m_uProtocolVersion >= 3)1245 if (m_pState->m_uProtocolVersion >= 3) 1246 1246 REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR); 1247 1247 REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA); 1248 1248 REGISTER_CALLBACK(GUEST_DND_GH_SND_DIR); 1249 if (m_p Resp->m_uProtocolVersion >= 2)1249 if (m_pState->m_uProtocolVersion >= 2) 1250 1250 REGISTER_CALLBACK(GUEST_DND_GH_SND_FILE_HDR); 1251 1251 REGISTER_CALLBACK(GUEST_DND_GH_SND_FILE_DATA); … … 1268 1268 GuestDnDMsg Msg; 1269 1269 Msg.setType(HOST_DND_GH_EVT_DROPPED); 1270 if (m_p Resp->m_uProtocolVersion >= 3)1270 if (m_pState->m_uProtocolVersion >= 3) 1271 1271 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 1272 1272 Msg.appendPointer((void*)pCtx->strFmtRecv.c_str(), (uint32_t)pCtx->strFmtRecv.length() + 1); … … 1281 1281 LogFlowFunc(("Waiting ...\n")); 1282 1282 1283 rc = waitForEvent(&pCtx->EventCallback, pCtx->p Resp, msTimeout);1283 rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout); 1284 1284 if (RT_SUCCESS(rc)) 1285 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);1285 rc = pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1286 1286 1287 1287 LogFlowFunc(("Waiting ended with rc=%Rrc\n", rc)); … … 1322 1322 AssertRC(rc2); 1323 1323 1324 rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED);1324 rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED); 1325 1325 AssertRC(rc2); 1326 1326 … … 1330 1330 else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */ 1331 1331 { 1332 rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR,1333 rc, GuestDnDSource::i_hostErrorToString(rc));1332 rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, 1333 rc, GuestDnDSource::i_hostErrorToString(rc)); 1334 1334 AssertRC(rc2); 1335 1335 } … … 1405 1405 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1406 1406 1407 pCtx->p Resp->reset();1407 pCtx->pState->reset(); 1408 1408 1409 1409 if (RT_SUCCESS(pCBData->rc)) … … 1414 1414 else if (pCBData->rc == VERR_WRONG_ORDER) 1415 1415 { 1416 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED);1416 rc = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED); 1417 1417 } 1418 1418 else 1419 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,1420 GuestDnDSource::i_guestErrorToString(pCBData->rc));1419 rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc, 1420 GuestDnDSource::i_guestErrorToString(pCBData->rc)); 1421 1421 1422 1422 LogRel3(("DnD: Guest reported data transfer error: %Rrc\n", pCBData->rc)); … … 1458 1458 1459 1459 /* Unregister this callback. */ 1460 AssertPtr(pCtx->p Resp);1461 int rc2 = pCtx->p Resp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);1460 AssertPtr(pCtx->pState); 1461 int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */); 1462 1462 AssertRC(rc2); 1463 1463 } … … 1564 1564 AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1565 1565 1566 if (pThis->m_p Resp->m_uProtocolVersion <= 1)1566 if (pThis->m_pState->m_uProtocolVersion <= 1) 1567 1567 { 1568 1568 /** … … 1589 1589 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1590 1590 1591 pCtx->p Resp->reset();1591 pCtx->pState->reset(); 1592 1592 1593 1593 if (RT_SUCCESS(pCBData->rc)) … … 1598 1598 else if (pCBData->rc == VERR_WRONG_ORDER) 1599 1599 { 1600 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED);1600 rc = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED); 1601 1601 } 1602 1602 else 1603 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,1604 GuestDnDSource::i_guestErrorToString(pCBData->rc));1603 rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc, 1604 GuestDnDSource::i_guestErrorToString(pCBData->rc)); 1605 1605 1606 1606 LogRel3(("DnD: Guest reported file transfer error: %Rrc\n", pCBData->rc)); … … 1642 1642 1643 1643 /* Unregister this callback. */ 1644 AssertPtr(pCtx->p Resp);1645 int rc2 = pCtx->p Resp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);1644 AssertPtr(pCtx->pState); 1645 int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */); 1646 1646 AssertRC(rc2); 1647 1647 } -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r85743 r85744 161 161 * nor 2) mixed transfers (G->H + H->G at the same time). 162 162 */ 163 m_p Resp = GuestDnDInst()->response();164 AssertPtrReturn(m_p Resp, E_POINTER);163 m_pState = GuestDnDInst()->getState(); 164 AssertPtrReturn(m_pState, E_POINTER); 165 165 166 166 /* Confirm a successful initialization when it's the case. */ … … 316 316 GuestDnDMsg Msg; 317 317 Msg.setType(HOST_DND_HG_EVT_ENTER); 318 if (m_p Resp->m_uProtocolVersion >= 3)318 if (m_pState->m_uProtocolVersion >= 3) 319 319 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 320 320 Msg.appendUInt32(aScreenId); … … 329 329 if (RT_SUCCESS(rc)) 330 330 { 331 if (RT_SUCCESS(m_p Resp->waitForGuestResponse()))332 resAction = GuestDnD::toMainAction(m_p Resp->getActionDefault());331 if (RT_SUCCESS(m_pState->waitForGuestResponse())) 332 resAction = GuestDnD::toMainAction(m_pState->getActionDefault()); 333 333 } 334 334 } … … 393 393 GuestDnDMsg Msg; 394 394 Msg.setType(HOST_DND_HG_EVT_MOVE); 395 if (m_p Resp->m_uProtocolVersion >= 3)395 if (m_pState->m_uProtocolVersion >= 3) 396 396 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 397 397 Msg.appendUInt32(aScreenId); … … 406 406 if (RT_SUCCESS(rc)) 407 407 { 408 GuestDnD Response *pResp = GuestDnDInst()->response();409 if (p Resp && RT_SUCCESS(pResp->waitForGuestResponse()))410 resAction = GuestDnD::toMainAction(p Resp->getActionDefault());408 GuestDnDState *pState = GuestDnDInst()->getState(); 409 if (pState && RT_SUCCESS(pState->waitForGuestResponse())) 410 resAction = GuestDnD::toMainAction(pState->getActionDefault()); 411 411 } 412 412 } … … 440 440 GuestDnDMsg Msg; 441 441 Msg.setType(HOST_DND_HG_EVT_LEAVE); 442 if (m_p Resp->m_uProtocolVersion >= 3)442 if (m_pState->m_uProtocolVersion >= 3) 443 443 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 444 444 … … 446 446 if (RT_SUCCESS(rc)) 447 447 { 448 GuestDnD Response *pResp = GuestDnDInst()->response();449 if (p Resp)450 p Resp->waitForGuestResponse();448 GuestDnDState *pState = GuestDnDInst()->getState(); 449 if (pState) 450 pState->waitForGuestResponse(); 451 451 } 452 452 … … 516 516 GuestDnDMsg Msg; 517 517 Msg.setType(HOST_DND_HG_EVT_DROPPED); 518 if (m_p Resp->m_uProtocolVersion >= 3)518 if (m_pState->m_uProtocolVersion >= 3) 519 519 Msg.appendUInt32(0); /** @todo ContextID not used yet. */ 520 520 Msg.appendUInt32(aScreenId); … … 529 529 if (RT_SUCCESS(vrc)) 530 530 { 531 GuestDnD Response *pResp = GuestDnDInst()->response();532 if (p Resp && RT_SUCCESS(pResp->waitForGuestResponse()))531 GuestDnDState *pState = GuestDnDInst()->getState(); 532 if (pState && RT_SUCCESS(pState->waitForGuestResponse())) 533 533 { 534 resAct = GuestDnD::toMainAction(p Resp->getActionDefault());535 536 GuestDnDMIMEList lstFormats = p Resp->formats();534 resAct = GuestDnD::toMainAction(pState->getActionDefault()); 535 536 GuestDnDMIMEList lstFormats = pState->formats(); 537 537 if (lstFormats.size() == 1) /* Exactly one format to use specified? */ 538 538 { … … 606 606 607 607 /* Reset progress object. */ 608 GuestDnD Response *pResp = GuestDnDInst()->response();609 AssertPtr(p Resp);610 HRESULT hr = p Resp->resetProgress(m_pGuest);608 GuestDnDState *pState = GuestDnDInst()->getState(); 609 AssertPtr(pState); 610 HRESULT hr = pState->resetProgress(m_pGuest); 611 611 if (FAILED(hr)) 612 612 return hr; … … 619 619 620 620 mData.mSendCtx.pTarget = this; 621 mData.mSendCtx.p Resp = pResp;621 mData.mSendCtx.pState = pState; 622 622 mData.mSendCtx.uScreenID = aScreenId; 623 623 … … 654 654 655 655 /* Return progress to caller. */ 656 hr = p Resp->queryProgressTo(aProgress.asOutParam());656 hr = pState->queryProgressTo(aProgress.asOutParam()); 657 657 ComAssertComRC(hr); 658 658 } … … 835 835 const char *pcszFmt = pCtx->Meta.strFmt.c_str(); 836 836 837 LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_p Resp->m_uProtocolVersion, pcszFmt, cbFmt, cbData));837 LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pState->m_uProtocolVersion, pcszFmt, cbFmt, cbData)); 838 838 839 839 LogRel2(("DnD: Sending meta data to guest as '%s' (%zu bytes)\n", pcszFmt, cbData)); … … 853 853 Msg.setType(HOST_DND_HG_SND_DATA); 854 854 855 if (m_p Resp->m_uProtocolVersion < 3)855 if (m_pState->m_uProtocolVersion < 3) 856 856 { 857 857 Msg.appendUInt32(pCtx->uScreenID); /* uScreenId */ … … 883 883 if (RT_SUCCESS(rc)) 884 884 { 885 rc = updateProgress(pCtx, pCtx->p Resp, (uint32_t)pCtx->Meta.cbData);885 rc = updateProgress(pCtx, pCtx->pState, (uint32_t)pCtx->Meta.cbData); 886 886 AssertRC(rc); 887 887 } … … 901 901 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 902 902 903 if (m_p Resp->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */903 if (m_pState->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */ 904 904 return VINF_SUCCESS; 905 905 … … 950 950 951 951 pMsg->setType(HOST_DND_HG_SND_DIR); 952 if (m_p Resp->m_uProtocolVersion >= 3)952 if (m_pState->m_uProtocolVersion >= 3) 953 953 pMsg->appendUInt32(0); /** @todo ContextID not used yet. */ 954 954 pMsg->appendString(pcszDstPath); /* path */ … … 997 997 if (RT_SUCCESS(rc)) 998 998 { 999 if (m_p Resp->m_uProtocolVersion >= 2)999 if (m_pState->m_uProtocolVersion >= 2) 1000 1000 { 1001 1001 if (!(pCtx->Transfer.fObjState & DND_OBJ_STATE_HAS_HDR)) … … 1067 1067 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 1068 1068 1069 AssertPtrReturn(pCtx->p Resp, VERR_WRONG_ORDER);1069 AssertPtrReturn(pCtx->pState, VERR_WRONG_ORDER); 1070 1070 1071 1071 /** @todo Don't allow concurrent reads per context! */ … … 1079 1079 /* Protocol version 1 sends the file path *every* time with a new file chunk. 1080 1080 * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */ 1081 if (m_p Resp->m_uProtocolVersion <= 1)1081 if (m_pState->m_uProtocolVersion <= 1) 1082 1082 { 1083 1083 const size_t cchDstPath = RTStrNLen(pcszDstPath, RTPATH_MAX); … … 1086 1086 pMsg->appendUInt32((uint32_t)cchDstPath + 1); /* cbName */ 1087 1087 } 1088 else if (m_p Resp->m_uProtocolVersion >= 2)1088 else if (m_pState->m_uProtocolVersion >= 2) 1089 1089 { 1090 1090 pMsg->appendUInt32(0); /** @todo ContextID not used yet. */ … … 1103 1103 LogFlowFunc(("cbBufe=%zu, cbRead=%RU32\n", cbBuf, cbRead)); 1104 1104 1105 if (m_p Resp->m_uProtocolVersion <= 1)1105 if (m_pState->m_uProtocolVersion <= 1) 1106 1106 { 1107 1107 pMsg->appendPointer(pvBuf, cbRead); /* pvData */ … … 1114 1114 pMsg->appendUInt32(cbRead); /* cbData */ 1115 1115 1116 if (m_p Resp->m_uProtocolVersion >= 3)1116 if (m_pState->m_uProtocolVersion >= 3) 1117 1117 { 1118 1118 /** @todo Calculate checksum. */ … … 1122 1122 } 1123 1123 1124 int rc2 = updateProgress(pCtx, pCtx->p Resp, (uint32_t)cbRead);1124 int rc2 = updateProgress(pCtx, pCtx->pState, (uint32_t)cbRead); 1125 1125 AssertRC(rc2); 1126 1126 … … 1223 1223 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1224 1224 1225 pCtx->p Resp->reset();1225 pCtx->pState->reset(); 1226 1226 1227 1227 if (RT_SUCCESS(pCBData->rc)) … … 1231 1231 } 1232 1232 1233 rc = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,1234 GuestDnDTarget::i_guestErrorToString(pCBData->rc));1233 rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc, 1234 GuestDnDTarget::i_guestErrorToString(pCBData->rc)); 1235 1235 if (RT_SUCCESS(rc)) 1236 1236 { … … 1343 1343 { 1344 1344 /* Unregister this callback. */ 1345 AssertPtr(pCtx->p Resp);1346 int rc2 = pCtx->p Resp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);1345 AssertPtr(pCtx->pState); 1346 int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */); 1347 1347 AssertRC(rc2); 1348 1348 … … 1373 1373 { 1374 1374 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1375 AssertPtr(pCtx->p Resp);1375 AssertPtr(pCtx->pState); 1376 1376 1377 1377 #define REGISTER_CALLBACK(x) \ 1378 1378 do { \ 1379 rc = pCtx->p Resp->setCallback(x, i_sendTransferDataCallback, pCtx); \1379 rc = pCtx->pState->setCallback(x, i_sendTransferDataCallback, pCtx); \ 1380 1380 if (RT_FAILURE(rc)) \ 1381 1381 return rc; \ … … 1384 1384 #define UNREGISTER_CALLBACK(x) \ 1385 1385 do { \ 1386 int rc2 = pCtx->p Resp->setCallback(x, NULL); \1386 int rc2 = pCtx->pState->setCallback(x, NULL); \ 1387 1387 AssertRC(rc2); \ 1388 1388 } while (0) … … 1406 1406 /* Host callbacks. */ 1407 1407 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1408 if (m_p Resp->m_uProtocolVersion >= 2)1408 if (m_pState->m_uProtocolVersion >= 2) 1409 1409 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1410 1410 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); … … 1473 1473 * Send the data header first. 1474 1474 */ 1475 if (m_p Resp->m_uProtocolVersion >= 3)1475 if (m_pState->m_uProtocolVersion >= 3) 1476 1476 rc = i_sendMetaDataHeader(pCtx); 1477 1477 … … 1484 1484 if (RT_SUCCESS(rc)) 1485 1485 { 1486 rc = waitForEvent(&pCtx->EventCallback, pCtx->p Resp, msTimeout);1486 rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout); 1487 1487 if (RT_SUCCESS(rc)) 1488 pCtx->p Resp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);1488 pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1489 1489 } 1490 1490 … … 1501 1501 /* Host callbacks. */ 1502 1502 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1503 if (m_p Resp->m_uProtocolVersion >= 2)1503 if (m_pState->m_uProtocolVersion >= 2) 1504 1504 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1505 1505 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); … … 1522 1522 LogRel2(("DnD: Sending transfer data to guest cancelled by user\n")); 1523 1523 1524 rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);1524 rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS); 1525 1525 AssertRC(rc2); 1526 1526 … … 1531 1531 { 1532 1532 LogRel(("DnD: Sending transfer data to guest failed with rc=%Rrc\n", rc)); 1533 int rc2 = pCtx->p Resp->setProgress(100, DND_PROGRESS_ERROR, rc,1534 GuestDnDTarget::i_hostErrorToString(rc));1533 int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, rc, 1534 GuestDnDTarget::i_hostErrorToString(rc)); 1535 1535 AssertRC(rc2); 1536 1536 } … … 1555 1555 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 1556 1556 1557 int rc = updateProgress(pCtx, pCtx->p Resp);1557 int rc = updateProgress(pCtx, pCtx->pState); 1558 1558 AssertRCReturn(rc, rc); 1559 1559 … … 1619 1619 { 1620 1620 LogRel(("DnD: Sending raw data to guest failed with rc=%Rrc\n", rc)); 1621 rc2 = pCtx->p Resp->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,1622 GuestDnDTarget::i_hostErrorToString(rc));1621 rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc, 1622 GuestDnDTarget::i_hostErrorToString(rc)); 1623 1623 } 1624 1624 else 1625 rc2 = pCtx->p Resp->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);1625 rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc); 1626 1626 AssertRC(rc2); 1627 1627
Note:
See TracChangeset
for help on using the changeset viewer.